fix: harden gateway process shutdown lifecycle

Co-authored-by: Haze <hazeone@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-03-18 12:09:25 +00:00
committed by Haze
parent 6b0400e3c3
commit 4d6a60fa77
9 changed files with 285 additions and 13 deletions

View File

@@ -0,0 +1,23 @@
import { describe, expect, it } from 'vitest';
import {
createQuitLifecycleState,
markQuitCleanupCompleted,
requestQuitLifecycleAction,
} from '@electron/main/quit-lifecycle';
describe('main quit lifecycle coordination', () => {
it('starts cleanup only once', () => {
const state = createQuitLifecycleState();
expect(requestQuitLifecycleAction(state)).toBe('start-cleanup');
expect(requestQuitLifecycleAction(state)).toBe('cleanup-in-progress');
});
it('allows quit after cleanup is marked complete', () => {
const state = createQuitLifecycleState();
expect(requestQuitLifecycleAction(state)).toBe('start-cleanup');
markQuitCleanupCompleted(state);
expect(requestQuitLifecycleAction(state)).toBe('allow-quit');
});
});