From 6bf8e191cb7fb8ad7743ff418f9e8e19b5e4915a Mon Sep 17 00:00:00 2001 From: Timothy Date: Tue, 21 Jul 2026 23:25:22 +0200 Subject: [PATCH] test(60): prove the failed-flag reset effect actually runs on channel switch The reset moved from render-phase into an effect; the existing switch test asserted only that the error banner cleared, which stays green even if the effect is deleted. Now the new channel must also reach 'playing'. Negative control: disabling the reset fails exactly this test, and only it. Refs #60 --- web/src/screens/channels/ChannelPreviewPanel.test.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/web/src/screens/channels/ChannelPreviewPanel.test.tsx b/web/src/screens/channels/ChannelPreviewPanel.test.tsx index f70455367..f05d5a903 100644 --- a/web/src/screens/channels/ChannelPreviewPanel.test.tsx +++ b/web/src/screens/channels/ChannelPreviewPanel.test.tsx @@ -287,6 +287,17 @@ describe('ChannelPreviewPanel', () => { expect(screen.queryByText(/networkError: manifestLoadError/)).not.toBeInTheDocument(); expect(hlsMock.loadSource).toHaveBeenLastCalledWith('/iptv/channel/34.1.m3u8'); + + // The failed-flag reset runs in an effect, not during render, so prove it actually ran: the + // new channel must still be able to reach `playing`. Without this assertion, deleting that + // reset leaves the suite green while the new channel sits at `starting` forever, because + // onPlaying would keep returning early on the PREVIOUS channel's stale failed flag. + const video = document.body.querySelector('video'); + act(() => { + video?.dispatchEvent(new Event('playing')); + }); + + expect(screen.getByText('playing')).toBeInTheDocument(); }); it('does not carry the retry play token over to the next channel', () => {