Files
SubMiner/src/core/services/runtime-options-ipc.test.ts
T
sudacode 7909fcd2cf refactor(ipc): remove dead preload methods and the ASS line broadcast (#293)
Drop 16 overlay preload methods with no caller (onSubtitleAss,
getCurrentSubtitleAss, onVisibility, getOverlayVisibility,
openYomitanSettings, quitApp, toggleOverlay, getMecabStatus,
setMecabEnabled, getKeybindings, saveControllerPreference,
getAnkiConnectStatus, setAnkiConnectEnabled, clearAnkiConnectHistory,
cycleRuntimeOption, appendClipboardVideoToQueue) along with their
IPC_CHANNELS keys, handlers, validators and dep plumbing.

With both ASS consumers gone, stop observing sub-text/ass in mpv and
remove the subtitle-ass-change event chain and appState.currentSubAssText.
The main-process functions these wrapped stay; tray, CLI, shortcuts and
session actions still use them.
2026-10-12 22:11:17 -07:00

27 lines
862 B
TypeScript

import test from 'node:test';
import assert from 'node:assert/strict';
import {
applyRuntimeOptionResultRuntime,
setRuntimeOptionFromIpcRuntime,
} from './runtime-options-ipc';
test('applyRuntimeOptionResultRuntime emits success OSD message', () => {
const osd: string[] = [];
const result = applyRuntimeOptionResultRuntime({ ok: true, osdMessage: 'Updated' }, (text) => {
osd.push(text);
});
assert.equal(result.ok, true);
assert.deepEqual(osd, ['Updated']);
});
test('setRuntimeOptionFromIpcRuntime returns unavailable when manager missing', () => {
const osd: string[] = [];
const result = setRuntimeOptionFromIpcRuntime(null, 'anki.autoUpdateNewCards', true, (text) => {
osd.push(text);
});
assert.equal(result.ok, false);
assert.equal(result.error, 'Runtime options manager unavailable');
assert.deepEqual(osd, []);
});