Files
SubMiner/src/main/runtime/ipc-bridge-actions-main-deps.test.ts
sudacode 6ae3888b53 feat: add playlist browser overlay modal
- Add overlay modal for browsing sibling video files and live mpv queue
- Add IPC commands for playlist operations (add, remove, move, play)
- Add playlist-browser-runtime and playlist-browser-sort modules
- Add keyboard handler and preload bindings for playlist browser
- Add default Ctrl+Alt+P keybinding to open the modal
- Add HTML structure, renderer wiring, and state for the modal
- Add changelog fragment and docs updates
2026-03-30 01:50:38 -07:00

42 lines
1.6 KiB
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import {
createBuildHandleMpvCommandFromIpcMainDepsHandler,
createBuildRunSubsyncManualFromIpcMainDepsHandler,
} from './ipc-bridge-actions-main-deps';
test('ipc bridge action main deps builders map callbacks', async () => {
const calls: string[] = [];
const handleMpv = createBuildHandleMpvCommandFromIpcMainDepsHandler({
handleMpvCommandFromIpcRuntime: (command) => calls.push(`mpv:${command.join(':')}`),
buildMpvCommandDeps: () => ({
triggerSubsyncFromConfig: async () => {},
openRuntimeOptionsPalette: () => {},
openYoutubeTrackPicker: () => {},
openPlaylistBrowser: () => {},
cycleRuntimeOption: () => ({ ok: false as const, error: 'x' }),
showMpvOsd: () => {},
replayCurrentSubtitle: () => {},
playNextSubtitle: () => {},
shiftSubDelayToAdjacentSubtitle: async () => {},
sendMpvCommand: () => {},
getMpvClient: () => null,
isMpvConnected: () => true,
hasRuntimeOptionsManager: () => true,
}),
})();
handleMpv.handleMpvCommandFromIpcRuntime(['show-text', 'hello'], handleMpv.buildMpvCommandDeps());
assert.equal(handleMpv.buildMpvCommandDeps().isMpvConnected(), true);
const runSubsync = createBuildRunSubsyncManualFromIpcMainDepsHandler({
runManualFromIpc: async (request: { id: string }) => {
calls.push(`subsync:${request.id}`);
return { ok: true as const };
},
})();
assert.deepEqual(await runSubsync.runManualFromIpc({ id: 'job-1' }), { ok: true });
assert.deepEqual(calls, ['mpv:show-text:hello', 'subsync:job-1']);
});