fix(logging): surface subtitle processing debug/warn logs (#182)

This commit is contained in:
sudacode authored and GitHub committed 2026-08-03 20:44:39 -07:00
1 parent 5b8848518a
commit bffb1c5982
13 files changed
+208 -6

No files matched your search

@@ -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({