Files
SubMiner/src/main/runtime/startup-lifecycle-main-deps.test.ts
T
sudacode a013a7ea55 feat(sync-ui): defer app quit until async cleanup resolves
- check-host participates in active-run coordination and can be cancelled
- shutdown() cancels and awaits the active launcher run on quit
- onWillQuit calls preventDefault and re-triggers quit once cleanup settles
- Snapshot mode awaits tracker quiescent before writing output
- Auto-scheduler catches synchronous triggerHostSync failures
- SCP endpoint accepts Windows absolute paths; cmd.exe rejects % in quoted values
- runAppCommand unified (inherit vs pipe stdio) in launcher/mpv.ts
- Docs: add --check, --json, --ui, --sync-cli, --make-temp/--remove-temp examples
2026-07-12 03:35:39 -07:00

38 lines
1.4 KiB
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { createBuildAppLifecycleRuntimeRunnerMainDepsHandler } from './startup-lifecycle-main-deps';
test('app lifecycle runtime runner main deps builder maps lifecycle callbacks', async () => {
const calls: string[] = [];
const deps = createBuildAppLifecycleRuntimeRunnerMainDepsHandler({
app: {} as never,
platform: 'darwin',
shouldStartApp: () => true,
parseArgs: () => ({}) as never,
handleCliCommand: () => calls.push('handle-cli'),
printHelp: () => calls.push('help'),
logNoRunningInstance: () => calls.push('no-instance'),
onReady: async () => {
calls.push('ready');
},
onWillQuitCleanup: () => {
calls.push('cleanup');
},
shouldRestoreWindowsOnActivate: () => true,
restoreWindowsOnActivate: () => calls.push('restore'),
shouldQuitOnWindowAllClosed: () => false,
})();
assert.equal(deps.platform, 'darwin');
assert.equal(deps.shouldStartApp({} as never), true);
deps.handleCliCommand({} as never, 'initial');
deps.printHelp();
deps.logNoRunningInstance();
await deps.onReady();
deps.onWillQuitCleanup();
deps.restoreWindowsOnActivate();
assert.equal(deps.shouldRestoreWindowsOnActivate(), true);
assert.equal(deps.shouldQuitOnWindowAllClosed(), false);
assert.deepEqual(calls, ['handle-cli', 'help', 'no-instance', 'ready', 'cleanup', 'restore']);
});