mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-06 07:21:33 -07:00
fix(logging): surface subtitle processing debug/warn logs (#182)
This commit is contained in:
@@ -234,3 +234,26 @@ test('subtitle prefetch init clears parsed cues when initialization fails', asyn
|
||||
|
||||
assert.deepEqual(cueUpdates, [null]);
|
||||
});
|
||||
|
||||
test('subtitle prefetch init logs a warning when the source parses to zero cues', async () => {
|
||||
const warnings: string[] = [];
|
||||
const controller = createSubtitlePrefetchInitController({
|
||||
getCurrentService: () => null,
|
||||
setCurrentService: () => {},
|
||||
loadSubtitleSourceText: async () => 'not really subtitles',
|
||||
parseSubtitleCues: (): SubtitleCue[] => [],
|
||||
createSubtitlePrefetchService: () => {
|
||||
throw new Error('should not create a service without cues');
|
||||
},
|
||||
tokenizeSubtitle: async () => null,
|
||||
preCacheTokenization: () => {},
|
||||
isCacheFull: () => false,
|
||||
logInfo: () => {},
|
||||
logWarn: (message) => warnings.push(message),
|
||||
});
|
||||
|
||||
await controller.initSubtitlePrefetch('/tmp/broken.ass', 0);
|
||||
|
||||
assert.equal(warnings.length, 1);
|
||||
assert.match(warnings[0]!, /\[subtitle-prefetch\].*0 cues.*\/tmp\/broken\.ass/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user