mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-20 12:15:26 -07:00
fix(logging): surface subtitle processing debug/warn logs (#182)
This commit is contained in:
@@ -70,6 +70,24 @@ test('subtitle change handler broadcasts cached annotated payload immediately wh
|
||||
]);
|
||||
});
|
||||
|
||||
test('subtitle change handler logs debug when a cached payload is emitted immediately', () => {
|
||||
const debugs: string[] = [];
|
||||
const handler = createHandleMpvSubtitleChangeHandler({
|
||||
setCurrentSubText: () => {},
|
||||
getImmediateSubtitlePayload: (text) => (text ? { text, tokens: [] } : null),
|
||||
broadcastSubtitle: () => {},
|
||||
onSubtitleChange: () => {},
|
||||
refreshDiscordPresence: () => {},
|
||||
logDebug: (message) => debugs.push(message),
|
||||
});
|
||||
|
||||
handler({ text: 'キャッシュ済みの行' });
|
||||
handler({ text: '' });
|
||||
|
||||
assert.equal(debugs.length, 1);
|
||||
assert.match(debugs[0]!, /cached subtitle/);
|
||||
});
|
||||
|
||||
test('subtitle change handler emits cached annotation after forwarding the subtitle change', () => {
|
||||
const calls: string[] = [];
|
||||
const handler = createHandleMpvSubtitleChangeHandler({
|
||||
|
||||
Reference in New Issue
Block a user