mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-22 00:11:27 -07:00
feat(core): add Electron runtime, services, and app composition
This commit is contained in:
29
src/main/runtime/secondary-sub-mode-runtime-handler.test.ts
Normal file
29
src/main/runtime/secondary-sub-mode-runtime-handler.test.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { createCycleSecondarySubModeRuntimeHandler } from './secondary-sub-mode-runtime-handler';
|
||||
|
||||
test('secondary sub mode runtime handler composes deps for runtime call', () => {
|
||||
const calls: string[] = [];
|
||||
const handleCycleSecondarySubMode = createCycleSecondarySubModeRuntimeHandler({
|
||||
cycleSecondarySubModeMainDeps: {
|
||||
getSecondarySubMode: () => 'hidden',
|
||||
setSecondarySubMode: () => calls.push('set-mode'),
|
||||
getLastSecondarySubToggleAtMs: () => 10,
|
||||
setLastSecondarySubToggleAtMs: () => calls.push('set-ts'),
|
||||
broadcastToOverlayWindows: (channel, mode) => calls.push(`broadcast:${channel}:${mode}`),
|
||||
showMpvOsd: (text) => calls.push(`osd:${text}`),
|
||||
},
|
||||
cycleSecondarySubMode: (deps) => {
|
||||
deps.setSecondarySubMode('romaji' as never);
|
||||
deps.broadcastSecondarySubMode('romaji' as never);
|
||||
deps.showMpvOsd('romaji');
|
||||
},
|
||||
});
|
||||
|
||||
handleCycleSecondarySubMode();
|
||||
assert.deepEqual(calls, [
|
||||
'set-mode',
|
||||
'broadcast:secondary-subtitle:mode:romaji',
|
||||
'osd:romaji',
|
||||
]);
|
||||
});
|
||||
Reference in New Issue
Block a user