mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 12:54:07 -07:00
Rename expect methods. (#11046)
This commit is contained in:
committed by
GitHub
parent
4a5ef4d9f7
commit
a73b81452d
@@ -29,7 +29,7 @@ describe('Interactive Mode', () => {
|
|||||||
await run.type(longPrompt);
|
await run.type(longPrompt);
|
||||||
await run.type('\r');
|
await run.type('\r');
|
||||||
|
|
||||||
await run.waitForText('einstein', 25000);
|
await run.expectText('einstein', 25000);
|
||||||
|
|
||||||
await run.type('/compress');
|
await run.type('/compress');
|
||||||
// A small delay to allow React to re-render the command list.
|
// A small delay to allow React to re-render the command list.
|
||||||
@@ -52,8 +52,9 @@ describe('Interactive Mode', () => {
|
|||||||
const run = await rig.runInteractive();
|
const run = await rig.runInteractive();
|
||||||
|
|
||||||
await run.type('/compress');
|
await run.type('/compress');
|
||||||
|
// A small delay to allow React to re-render the command list.
|
||||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||||
await run.type('\r');
|
await run.type('\r');
|
||||||
await run.waitForText('compression was not beneficial', 25000);
|
await run.expectText('compression was not beneficial', 25000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ describe('Ctrl+C exit', () => {
|
|||||||
// Send first Ctrl+C
|
// Send first Ctrl+C
|
||||||
run.type('\x03');
|
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') {
|
if (os.platform() === 'win32') {
|
||||||
// This is a workaround for node-pty/winpty on Windows.
|
// 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.
|
// graceful shutdown message on Windows in this automated context.
|
||||||
run.kill();
|
run.kill();
|
||||||
|
|
||||||
const exitCode = await run.waitForExit();
|
const exitCode = await run.expectExit();
|
||||||
// On Windows, the exit code after ptyProcess.kill() can be unpredictable
|
// 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,
|
// (often 1), so we accept any non-null exit code as a pass condition,
|
||||||
// focusing on the fact that the process did terminate.
|
// focusing on the fact that the process did terminate.
|
||||||
@@ -42,9 +42,9 @@ describe('Ctrl+C exit', () => {
|
|||||||
// Send second Ctrl+C
|
// Send second Ctrl+C
|
||||||
run.type('\x03');
|
run.type('\x03');
|
||||||
|
|
||||||
const exitCode = await run.waitForExit();
|
const exitCode = await run.expectExit();
|
||||||
expect(exitCode, `Process exited with code ${exitCode}.`).toBe(0);
|
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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ describe('Interactive file system', () => {
|
|||||||
const readCall = await rig.waitForToolCall('read_file', 30000);
|
const readCall = await rig.waitForToolCall('read_file', 30000);
|
||||||
expect(readCall, 'Expected to find a read_file tool call').toBe(true);
|
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
|
// Step 2: Write the file
|
||||||
const writePrompt = `now change the version to 1.0.1 in the file`;
|
const writePrompt = `now change the version to 1.0.1 in the file`;
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ export class InteractiveRun {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitForText(text: string, timeout?: number) {
|
async expectText(text: string, timeout?: number) {
|
||||||
if (!timeout) {
|
if (!timeout) {
|
||||||
timeout = getDefaultTimeout();
|
timeout = getDefaultTimeout();
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ export class InteractiveRun {
|
|||||||
this.ptyProcess.kill();
|
this.ptyProcess.kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
waitForExit(): Promise<number> {
|
expectExit(): Promise<number> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const timer = setTimeout(
|
const timer = setTimeout(
|
||||||
() =>
|
() =>
|
||||||
@@ -902,7 +902,7 @@ export class TestRig {
|
|||||||
|
|
||||||
const run = new InteractiveRun(ptyProcess);
|
const run = new InteractiveRun(ptyProcess);
|
||||||
// Wait for the app to be ready
|
// Wait for the app to be ready
|
||||||
await run.waitForText('Type your message', 30000);
|
await run.expectText('Type your message', 30000);
|
||||||
return run;
|
return run;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user