mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-17 01:21:10 -07:00
chore: update test
This commit is contained in:
@@ -26,7 +26,12 @@ describe('processUtils', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
_resetRelaunchStateForTesting();
|
||||
process.send = vi.fn();
|
||||
process.send = vi.fn(
|
||||
(_msg: unknown, callback?: (err: Error | null) => void) => {
|
||||
if (callback) callback(null);
|
||||
return true;
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -46,10 +51,13 @@ describe('processUtils', () => {
|
||||
await relaunchApp('custom-session-id');
|
||||
expect(handleAutoUpdate.waitForUpdateCompletion).toHaveBeenCalledTimes(1);
|
||||
expect(runExitCleanup).toHaveBeenCalledTimes(1);
|
||||
expect(process.send).toHaveBeenCalledWith({
|
||||
type: 'relaunch-session',
|
||||
sessionId: 'custom-session-id',
|
||||
});
|
||||
expect(process.send).toHaveBeenCalledWith(
|
||||
{
|
||||
type: 'relaunch-session',
|
||||
sessionId: 'custom-session-id',
|
||||
},
|
||||
expect.any(Function),
|
||||
);
|
||||
expect(processExit).toHaveBeenCalledWith(RELAUNCH_EXIT_CODE);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -29,9 +29,14 @@ export async function relaunchApp(sessionId?: string): Promise<void> {
|
||||
await runExitCleanup();
|
||||
|
||||
if (process.send && sessionId) {
|
||||
process.send({
|
||||
type: 'relaunch-session',
|
||||
sessionId,
|
||||
await new Promise<void>((resolve) => {
|
||||
process.send!(
|
||||
{
|
||||
type: 'relaunch-session',
|
||||
sessionId,
|
||||
},
|
||||
() => resolve(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user