import '@testing-library/jest-dom/vitest'; // jsdom has no real media pipeline: HTMLMediaElement.prototype.play is unimplemented and returns // undefined rather than a Promise, which would otherwise force production code (HlsPlayer) to guard // every call site with `?.` purely to survive tests. Stub it to behave like a real browser instead — // tests that need an autoplay-blocked rejection can override it with vi.spyOn(...).mockRejectedValue. HTMLMediaElement.prototype.play = () => Promise.resolve(); if (!window.localStorage) { const storage = new Map(); Object.defineProperty(window, 'localStorage', { configurable: true, value: { clear: () => storage.clear(), getItem: (key: string) => storage.get(key) ?? null, removeItem: (key: string) => storage.delete(key), setItem: (key: string, value: string) => storage.set(key, value) } }); }