diff --git a/libs/portal/shared/data-access/src/lib/multi-source/vod-source-resolver-stream-info.spec.ts b/libs/portal/shared/data-access/src/lib/multi-source/vod-source-resolver-stream-info.spec.ts index 5df8a0de9..d791b81b6 100644 --- a/libs/portal/shared/data-access/src/lib/multi-source/vod-source-resolver-stream-info.spec.ts +++ b/libs/portal/shared/data-access/src/lib/multi-source/vod-source-resolver-stream-info.spec.ts @@ -5,8 +5,11 @@ import { readStreamInfo } from './vod-source-resolver.service'; * * The declared shape is a string array and that is what the mock server and * many panels send; others send the ffprobe object. Reading only one of them - * loses the provider's codec on every response of the other kind — and with - * it the "dub may differ" warning, which compares stated audio tracks. + * loses the provider's codec on every response of the other kind. + * + * What the array shape carries is a CODEC and nothing else — no language — so + * it can never feed the "dub may differ" warning. That is the honest outcome + * rather than a gap: a codec cannot tell one dub from another. */ describe('readStreamInfo', () => { it('reads the declared array shape', () => { @@ -30,6 +33,28 @@ describe('readStreamInfo', () => { expect(readStreamInfo([' H.264 '])).toEqual({ codec_name: 'H.264' }); }); + it('finds no language in the declared array shape', () => { + // The shape the repo's own mock sends. It states a codec, so the dub + // warning stays silent on every source that arrives this way — which + // is most of them, and is correct: AAC says nothing about which dub + // this is. + const audio = readStreamInfo(['AAC']); + + expect(audio?.language).toBeUndefined(); + expect(audio?.tags?.language).toBeUndefined(); + }); + + it('reads the language out of ffprobe tags when a panel sends them', () => { + expect( + readStreamInfo({ codec_name: 'ac3', tags: { language: 'rus' } }) + ?.tags?.language + ).toBe('rus'); + // Some panels hoist it out of `tags`. + expect( + readStreamInfo({ codec_name: 'ac3', language: 'eng' })?.language + ).toBe('eng'); + }); + it('says nothing when the provider said nothing', () => { // Empty beats wrong: an absent codec must not become a stated one. expect(readStreamInfo([])).toBeUndefined();