mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-22 00:11:27 -07:00
- Add default `f` fullscreen overlay binding and switch default AniSkip skip key to `Tab` - Make character-dictionary auto-sync non-blocking at startup with tokenization gating for Yomitan mutations - Add ordered startup OSD progress (checking/generating/updating/importing), refresh current subtitle on sync completion, and extend regression tests
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { createCurrentMediaTokenizationGate } from './current-media-tokenization-gate';
|
|
|
|
test('current media tokenization gate waits until current path is marked ready', async () => {
|
|
const gate = createCurrentMediaTokenizationGate();
|
|
gate.updateCurrentMediaPath('/tmp/video-1.mkv');
|
|
|
|
let resolved = false;
|
|
const waitPromise = gate.waitUntilReady('/tmp/video-1.mkv').then(() => {
|
|
resolved = true;
|
|
});
|
|
|
|
await Promise.resolve();
|
|
assert.equal(resolved, false);
|
|
|
|
gate.markReady('/tmp/video-1.mkv');
|
|
await waitPromise;
|
|
assert.equal(resolved, true);
|
|
});
|
|
|
|
test('current media tokenization gate resolves old waiters when media changes', async () => {
|
|
const gate = createCurrentMediaTokenizationGate();
|
|
gate.updateCurrentMediaPath('/tmp/video-1.mkv');
|
|
|
|
let resolved = false;
|
|
const waitPromise = gate.waitUntilReady('/tmp/video-1.mkv').then(() => {
|
|
resolved = true;
|
|
});
|
|
|
|
gate.updateCurrentMediaPath('/tmp/video-2.mkv');
|
|
await waitPromise;
|
|
assert.equal(resolved, true);
|
|
});
|
|
|
|
test('current media tokenization gate returns immediately for ready media', async () => {
|
|
const gate = createCurrentMediaTokenizationGate();
|
|
gate.updateCurrentMediaPath('/tmp/video-1.mkv');
|
|
gate.markReady('/tmp/video-1.mkv');
|
|
|
|
await gate.waitUntilReady('/tmp/video-1.mkv');
|
|
});
|