mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-20 12:11:28 -07:00
36 lines
1.4 KiB
TypeScript
36 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']);
|
|
});
|