test(player): harden audio policy i18n assertions
This commit is contained in:
@@ -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);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user