mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-21 12:11:28 -07:00
feat(core): add Electron runtime, services, and app composition
This commit is contained in:
26
src/main/runtime/jellyfin-subtitle-preload-main-deps.test.ts
Normal file
26
src/main/runtime/jellyfin-subtitle-preload-main-deps.test.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { createBuildPreloadJellyfinExternalSubtitlesMainDepsHandler } from './jellyfin-subtitle-preload-main-deps';
|
||||
|
||||
test('preload jellyfin external subtitles main deps builder maps callbacks', async () => {
|
||||
const calls: string[] = [];
|
||||
const deps = createBuildPreloadJellyfinExternalSubtitlesMainDepsHandler({
|
||||
listJellyfinSubtitleTracks: async () => {
|
||||
calls.push('list');
|
||||
return [];
|
||||
},
|
||||
getMpvClient: () => ({ requestProperty: async () => [] }),
|
||||
sendMpvCommand: () => calls.push('send'),
|
||||
wait: async () => {
|
||||
calls.push('wait');
|
||||
},
|
||||
logDebug: (message) => calls.push(`debug:${message}`),
|
||||
})();
|
||||
|
||||
await deps.listJellyfinSubtitleTracks({} as never, {} as never, 'item');
|
||||
assert.equal(typeof deps.getMpvClient()?.requestProperty, 'function');
|
||||
deps.sendMpvCommand(['set_property', 'sid', 'auto']);
|
||||
await deps.wait(1);
|
||||
deps.logDebug('oops', null);
|
||||
assert.deepEqual(calls, ['list', 'send', 'wait', 'debug:oops']);
|
||||
});
|
||||
Reference in New Issue
Block a user