From a73b81452d766c74b602602641e4399f77734313 Mon Sep 17 00:00:00 2001 From: Tommaso Sciortino Date: Mon, 13 Oct 2025 11:42:27 -0700 Subject: [PATCH] Rename expect methods. (#11046) --- integration-tests/context-compress-interactive.test.ts | 5 +++-- integration-tests/ctrl-c-exit.test.ts | 8 ++++---- integration-tests/file-system-interactive.test.ts | 2 +- integration-tests/test-helper.ts | 6 +++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/integration-tests/context-compress-interactive.test.ts b/integration-tests/context-compress-interactive.test.ts index d095faa145..35a9e9f18c 100644 --- a/integration-tests/context-compress-interactive.test.ts +++ b/integration-tests/context-compress-interactive.test.ts @@ -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); }); }); diff --git a/integration-tests/ctrl-c-exit.test.ts b/integration-tests/ctrl-c-exit.test.ts index 52188c74e1..02c13dd15e 100644 --- a/integration-tests/ctrl-c-exit.test.ts +++ b/integration-tests/ctrl-c-exit.test.ts @@ -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); }); }); diff --git a/integration-tests/file-system-interactive.test.ts b/integration-tests/file-system-interactive.test.ts index 59a69f584c..1b96e9ec10 100644 --- a/integration-tests/file-system-interactive.test.ts +++ b/integration-tests/file-system-interactive.test.ts @@ -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`; diff --git a/integration-tests/test-helper.ts b/integration-tests/test-helper.ts index 43e9d61264..41161d8a24 100644 --- a/integration-tests/test-helper.ts +++ b/integration-tests/test-helper.ts @@ -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 { + expectExit(): Promise { 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; } }