Files
fotospiel-app/resources/js/guest/services/__tests__/liveShowApi.test.ts
Codex Agent 53eb560aa5
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled
Add live show player playback and effects
2026-01-05 18:31:01 +01:00

35 lines
1.2 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import {
buildLiveShowStreamUrl,
DEFAULT_LIVE_SHOW_SETTINGS,
normalizeLiveShowSettings,
} from '../liveShowApi';
describe('liveShowApi', () => {
it('merges live show settings with defaults', () => {
const result = normalizeLiveShowSettings({
fixed_interval_seconds: 12,
effect_intensity: 15,
});
expect(result.fixed_interval_seconds).toBe(12);
expect(result.effect_intensity).toBe(15);
expect(result.layout_mode).toBe(DEFAULT_LIVE_SHOW_SETTINGS.layout_mode);
});
it('builds stream url with query params', () => {
const url = buildLiveShowStreamUrl('demo-token', {
cursor: { approved_at: '2025-01-01T00:00:00Z', id: 42 },
settingsVersion: 'abc',
limit: 60,
});
const parsed = new URL(url, 'http://example.test');
expect(parsed.pathname).toBe('/api/v1/live-show/demo-token/stream');
expect(parsed.searchParams.get('after_approved_at')).toBe('2025-01-01T00:00:00Z');
expect(parsed.searchParams.get('after_id')).toBe('42');
expect(parsed.searchParams.get('settings_version')).toBe('abc');
expect(parsed.searchParams.get('limit')).toBe('60');
});
});