mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-01 06:22:44 -08:00
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
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',
|
|
]);
|
|
});
|