Rename expect methods. (#11046)

This commit is contained in:
Tommaso Sciortino
2025-10-13 11:42:27 -07:00
committed by GitHub
parent 4a5ef4d9f7
commit a73b81452d
4 changed files with 11 additions and 10 deletions

View File

@@ -29,7 +29,7 @@ describe('Interactive Mode', () => {
await run.type(longPrompt);
await run.type('\r');
await run.waitForText('einstein', 25000);
await run.expectText('einstein', 25000);
await run.type('/compress');
// A small delay to allow React to re-render the command list.
@@ -52,8 +52,9 @@ describe('Interactive Mode', () => {
const run = await rig.runInteractive();
await run.type('/compress');
// A small delay to allow React to re-render the command list.
await new Promise((resolve) => setTimeout(resolve, 100));
await run.type('\r');
await run.waitForText('compression was not beneficial', 25000);
await run.expectText('compression was not beneficial', 25000);
});
});

View File

@@ -18,7 +18,7 @@ describe('Ctrl+C exit', () => {
// Send first Ctrl+C
run.type('\x03');
await run.waitForText('Press Ctrl+C again to exit', 5000);
await run.expectText('Press Ctrl+C again to exit', 5000);
if (os.platform() === 'win32') {
// This is a workaround for node-pty/winpty on Windows.
@@ -31,7 +31,7 @@ describe('Ctrl+C exit', () => {
// graceful shutdown message on Windows in this automated context.
run.kill();
const exitCode = await run.waitForExit();
const exitCode = await run.expectExit();
// On Windows, the exit code after ptyProcess.kill() can be unpredictable
// (often 1), so we accept any non-null exit code as a pass condition,
// focusing on the fact that the process did terminate.
@@ -42,9 +42,9 @@ describe('Ctrl+C exit', () => {
// Send second Ctrl+C
run.type('\x03');
const exitCode = await run.waitForExit();
const exitCode = await run.expectExit();
expect(exitCode, `Process exited with code ${exitCode}.`).toBe(0);
await run.waitForText('Agent powering down. Goodbye!', 5000);
await run.expectText('Agent powering down. Goodbye!', 5000);
});
});

View File

@@ -33,7 +33,7 @@ describe('Interactive file system', () => {
const readCall = await rig.waitForToolCall('read_file', 30000);
expect(readCall, 'Expected to find a read_file tool call').toBe(true);
await run.waitForText('1.0.0', 30000);
await run.expectText('1.0.0', 30000);
// Step 2: Write the file
const writePrompt = `now change the version to 1.0.1 in the file`;

View File

@@ -182,7 +182,7 @@ export class InteractiveRun {
});
}
async waitForText(text: string, timeout?: number) {
async expectText(text: string, timeout?: number) {
if (!timeout) {
timeout = getDefaultTimeout();
}
@@ -207,7 +207,7 @@ export class InteractiveRun {
this.ptyProcess.kill();
}
waitForExit(): Promise<number> {
expectExit(): Promise<number> {
return new Promise((resolve, reject) => {
const timer = setTimeout(
() =>
@@ -902,7 +902,7 @@ export class TestRig {
const run = new InteractiveRun(ptyProcess);
// Wait for the app to be ready
await run.waitForText('Type your message', 30000);
await run.expectText('Type your message', 30000);
return run;
}
}