From ed57efb1b3ba6bca06ca980c6d92903a6b1ba780 Mon Sep 17 00:00:00 2001 From: DEV-bot Date: Mon, 2 Mar 2026 01:58:40 +0000 Subject: [PATCH] test(player): harden audio policy i18n assertions --- .../player/player-shell.component.spec.ts | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/frontend/angular/src/app/features/player/player-shell.component.spec.ts b/frontend/angular/src/app/features/player/player-shell.component.spec.ts index 17c30f1..ed8b19a 100644 --- a/frontend/angular/src/app/features/player/player-shell.component.spec.ts +++ b/frontend/angular/src/app/features/player/player-shell.component.spec.ts @@ -1,5 +1,6 @@ import { afterEach, describe, expect, it, vi } from 'vitest'; +import lobbyCatalog from '../../../../../../shared/i18n/lobby.json'; import { PlayerShellComponent } from './player-shell.component'; type FetchMock = ReturnType; @@ -467,11 +468,27 @@ describe('PlayerShellComponent gameplay wiring', () => { component.ngOnDestroy(); }); - it('exposes i18n warning copy for phone-client audio policy', () => { + it('resolves i18n warning copy from shared catalog without key fallback', () => { const component = new PlayerShellComponent(); + const notice = component.copy('player.audio_policy_notice'); + const expected = lobbyCatalog.frontend.ui.player.audio_policy_notice[component.locale]; + + expect(notice).toBe(expected); + expect(notice).not.toBe('player.audio_policy_notice'); + }); + + it('gates template warning notice on the no-audio-output capability flag', () => { + const templateSource = String((PlayerShellComponent as any).ɵcmp?.template); + + expect(templateSource).toContain('clientHasNoAudioOutput'); + + const component = new PlayerShellComponent(); expect(component.copy('player.audio_policy_notice')).not.toBe('player.audio_policy_notice'); - expect(component.copy('player.audio_policy_notice')).toContain('Audio'); + expect(component.clientHasNoAudioOutput).toBe(true); + + (component as any).clientHasNoAudioOutput = false; + expect(component.clientHasNoAudioOutput).toBe(false); }); });