mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-02 06:22:42 -08:00
feat(core): add Electron runtime, services, and app composition
This commit is contained in:
33
src/main/runtime/cli-command-runtime-handler.test.ts
Normal file
33
src/main/runtime/cli-command-runtime-handler.test.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { createCliCommandRuntimeHandler } from './cli-command-runtime-handler';
|
||||
|
||||
test('cli command runtime handler applies precheck and forwards command with context', () => {
|
||||
const calls: string[] = [];
|
||||
const handler = createCliCommandRuntimeHandler({
|
||||
handleTexthookerOnlyModeTransitionMainDeps: {
|
||||
isTexthookerOnlyMode: () => true,
|
||||
setTexthookerOnlyMode: () => calls.push('set-mode'),
|
||||
commandNeedsOverlayRuntime: () => true,
|
||||
startBackgroundWarmups: () => calls.push('warmups'),
|
||||
logInfo: (message) => calls.push(`log:${message}`),
|
||||
},
|
||||
createCliCommandContext: () => {
|
||||
calls.push('context');
|
||||
return { id: 'ctx' };
|
||||
},
|
||||
handleCliCommandRuntimeServiceWithContext: (_args, source, context) => {
|
||||
calls.push(`cli:${source}:${context.id}`);
|
||||
},
|
||||
});
|
||||
|
||||
handler({ start: true } as never);
|
||||
|
||||
assert.deepEqual(calls, [
|
||||
'set-mode',
|
||||
'log:Disabling texthooker-only mode after overlay/start command.',
|
||||
'warmups',
|
||||
'context',
|
||||
'cli:initial:ctx',
|
||||
]);
|
||||
});
|
||||
Reference in New Issue
Block a user