mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-21 00:11:27 -07:00
feat(core): add Electron runtime, services, and app composition
This commit is contained in:
35
src/main/runtime/startup-lifecycle-main-deps.test.ts
Normal file
35
src/main/runtime/startup-lifecycle-main-deps.test.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
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']);
|
||||
});
|
||||
Reference in New Issue
Block a user