From 960a33940fa436b7ad2102813527a02031e41b8d Mon Sep 17 00:00:00 2001 From: 4gray Date: Wed, 29 Jul 2026 20:58:48 +0200 Subject: [PATCH] test(portals): pin what the declared audio shape can and cannot say MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The array shape the mock server and many panels send carries a codec and no language, so the dub warning is silent for every source arriving that way. Asserted rather than assumed, alongside the ffprobe shapes that do carry one — otherwise a later reader sees an unused field and wires the codec back into the warning. Co-Authored-By: Claude Opus 5 --- .../vod-source-resolver-stream-info.spec.ts | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) 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();