diff --git a/frontend/src/components/__tests__/FloatingVideo.test.jsx b/frontend/src/components/__tests__/FloatingVideo.test.jsx index b511b60b..f99a3dcc 100644 --- a/frontend/src/components/__tests__/FloatingVideo.test.jsx +++ b/frontend/src/components/__tests__/FloatingVideo.test.jsx @@ -243,8 +243,9 @@ describe('FloatingVideo', () => { const { container } = render(); const video = container.querySelector('video'); - // Simulate video loaded event to clear loading state + // Simulate video loaded and canplay events to clear loading state and show overlay fireEvent.loadedData(video); + fireEvent.canPlay(video); expect(screen.getAllByText('Test Movie').length).toBeGreaterThanOrEqual( 1 diff --git a/frontend/src/components/cards/__tests__/StreamConnectionCard.test.jsx b/frontend/src/components/cards/__tests__/StreamConnectionCard.test.jsx index fd1b4164..1a62cc2c 100644 --- a/frontend/src/components/cards/__tests__/StreamConnectionCard.test.jsx +++ b/frontend/src/components/cards/__tests__/StreamConnectionCard.test.jsx @@ -42,7 +42,6 @@ vi.mock('../../../utils/cards/StreamConnectionCardUtils.js', () => ({ getChannelStreams: vi.fn(() => Promise.resolve([])), getLogoUrl: vi.fn(() => null), getM3uAccountsMap: vi.fn(() => ({})), - getMatchingStreamByUrl: vi.fn(() => null), getSelectedStream: vi.fn(() => null), getStartDate: vi.fn(() => 'Jan 1 2024 10:00 AM'), getStreamOptions: vi.fn(() => []), @@ -181,7 +180,6 @@ import useVideoStore from '../../../store/useVideoStore'; import { showNotification } from '../../../utils/notificationUtils.js'; import { getChannelStreams, - getMatchingStreamByUrl, getSelectedStream, getStreamsByIds, switchStream, @@ -628,7 +626,7 @@ describe('StreamConnectionCard', () => { }); }); - it('sets activeStreamId when a matching stream is found by URL', async () => { + it('sets activeStreamId when a matching stream is found by stream_id', async () => { vi.mocked(getChannelStreams).mockResolvedValue([ { id: 42, @@ -637,15 +635,10 @@ describe('StreamConnectionCard', () => { m3u_profile: null, }, ]); - vi.mocked(getMatchingStreamByUrl).mockReturnValue({ - id: 42, - name: 'Stream A', - url: 'http://stream.example.com/ch1', - m3u_profile: null, - }); render(); await waitFor(() => { - expect(getMatchingStreamByUrl).toHaveBeenCalled(); + // defaultProps channel has stream_id: 42, which matches the stream id above + expect(getChannelStreams).toHaveBeenCalled(); }); });