veza/apps/web/src/features/player/hooks/useAirPlaySupport.test.ts
senke 32cacdcf09 feat(v0.13.4): polish audio & player — PiP canvas, visualizer, Cast/AirPlay stubs
TASK-APLSH-001: Enhanced PiP with canvas-based display showing cover art + track info
TASK-APLSH-002: Chromecast detection hook (useCastSupport) — full casting deferred
TASK-APLSH-003: AirPlay detection hook (useAirPlaySupport) — Safari target picker
TASK-APLSH-004: AudioVisualizer component with 3 modes (bars/wave/spectrogram)
  - useSpectrumAnalyser hook (64 bands, high-res FFT)
  - Canvas-based rendering with SUMI color palette
  - Integrated into PlayerExpanded with toggle button

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:59:30 +01:00

24 lines
976 B
TypeScript

import { describe, it, expect } from 'vitest';
import { renderHook } from '@testing-library/react';
import { useAirPlaySupport } from './useAirPlaySupport';
describe('useAirPlaySupport', () => {
it('should report AirPlay as unavailable when no audio element', () => {
const { result } = renderHook(() => useAirPlaySupport(null));
expect(result.current.isAvailable).toBe(false);
});
it('should report AirPlay as unavailable on non-Safari browsers', () => {
const audio = document.createElement('audio');
const { result } = renderHook(() => useAirPlaySupport(audio));
expect(result.current.isAvailable).toBe(false);
});
it('should provide showPicker callback', () => {
const audio = document.createElement('audio');
const { result } = renderHook(() => useAirPlaySupport(audio));
expect(typeof result.current.showPicker).toBe('function');
// Should not throw even without Safari support
result.current.showPicker();
});
});