test(player): harden audio policy i18n assertions
All checks were successful
CI / test-and-quality (push) Successful in 3m17s
CI / test-and-quality (pull_request) Successful in 3m9s

This commit is contained in:
2026-03-02 01:58:40 +00:00
parent dc6af7547c
commit ed57efb1b3

View File

@@ -1,5 +1,6 @@
import { afterEach, describe, expect, it, vi } from 'vitest'; import { afterEach, describe, expect, it, vi } from 'vitest';
import lobbyCatalog from '../../../../../../shared/i18n/lobby.json';
import { PlayerShellComponent } from './player-shell.component'; import { PlayerShellComponent } from './player-shell.component';
type FetchMock = ReturnType<typeof vi.fn>; type FetchMock = ReturnType<typeof vi.fn>;
@@ -467,11 +468,27 @@ describe('PlayerShellComponent gameplay wiring', () => {
component.ngOnDestroy(); 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 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')).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);
}); });
}); });