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