fix: close phase 2 journey blockers

This commit is contained in:
2026-09-02 06:04:20 +03:00
parent a86767cdc6
commit 77895c01ff
19 changed files with 378 additions and 26 deletions

View File

@@ -7,6 +7,7 @@ import {
type AdaptiveQualityController,
type QualityDecision,
} from '@/journey/adaptive-quality';
import type { QualityTier } from '@/journey/motion-policy';
afterEach(() => {
vi.restoreAllMocks();
@@ -265,6 +266,26 @@ describe('useAdaptiveQuality', () => {
expect(wrapper.vm.snapshot.epoch).toBeNull();
expect(documentRemove).toHaveBeenCalledWith('visibilitychange', expect.any(Function), { passive: true });
});
it('never lets a visitor request bypass the device-resolved maximum', async () => {
const { useAdaptiveQuality } = await import('@/composables/useAdaptiveQuality');
Object.defineProperty(document, 'visibilityState', {
configurable: true,
value: 'visible',
});
const maximum = ref<QualityTier>('low');
const sceneState = ref('running');
const pageLifecycle = ref<'active'>('active');
const wrapper = mount(defineComponent({
setup: () => useAdaptiveQuality({ maximum, sceneState, pageLifecycle, now: () => 0 }),
template: '<output />',
}));
expect(wrapper.vm.setMaximum('high', 'manual')).toBeNull();
expect(wrapper.vm.snapshot).toMatchObject({ maximum: 'low', actual: 'low' });
wrapper.unmount();
});
});
function feedWindow(