mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-01 06:22:44 -08:00
refactor: extract ipc mpv and tokenizer runtime deps
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { createRuntimeOptionsIpcDepsRuntimeService } from "./runtime-options-ipc-deps-runtime-service";
|
||||
|
||||
test("createRuntimeOptionsIpcDepsRuntimeService delegates set/cycle with osd", () => {
|
||||
const osd: string[] = [];
|
||||
const deps = createRuntimeOptionsIpcDepsRuntimeService({
|
||||
getRuntimeOptionsManager: () => ({
|
||||
setOptionValue: () => ({ ok: true, osdMessage: "set ok" }),
|
||||
cycleOption: () => ({ ok: true, osdMessage: "cycle ok" }),
|
||||
}),
|
||||
showMpvOsd: (text) => {
|
||||
osd.push(text);
|
||||
},
|
||||
});
|
||||
|
||||
const setResult = deps.setRuntimeOption("subtitles.secondaryMode", "hidden") as {
|
||||
ok: boolean;
|
||||
};
|
||||
const cycleResult = deps.cycleRuntimeOption("subtitles.secondaryMode", 1) as {
|
||||
ok: boolean;
|
||||
};
|
||||
|
||||
assert.equal(setResult.ok, true);
|
||||
assert.equal(cycleResult.ok, true);
|
||||
assert.ok(osd.includes("set ok"));
|
||||
assert.ok(osd.includes("cycle ok"));
|
||||
});
|
||||
Reference in New Issue
Block a user