From d39b0777155a086ced02964efe4dd199f4534733 Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Fri, 6 Mar 2026 14:51:34 -0600 Subject: [PATCH] Rename fetchChannels to fetchChannelIds in M3URefreshNotification component and tests --- .../src/components/M3URefreshNotification.jsx | 19 +++++------ .../__tests__/M3URefreshNotification.test.jsx | 32 +++++++++++-------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/frontend/src/components/M3URefreshNotification.jsx b/frontend/src/components/M3URefreshNotification.jsx index 8fd461b4..263cb46c 100644 --- a/frontend/src/components/M3URefreshNotification.jsx +++ b/frontend/src/components/M3URefreshNotification.jsx @@ -16,7 +16,7 @@ const M3uSetupSuccess = (data) => { const onClickRefresh = () => { API.refreshPlaylist(data.account); - } + }; const onClickConfigure = () => { // Store the ID we want to edit in the store first @@ -25,7 +25,7 @@ const M3uSetupSuccess = (data) => { // Then navigate to the content sources page // Using the exact path that matches your app's routing structure navigate('/sources'); - } + }; return ( @@ -41,14 +41,14 @@ const M3uSetupSuccess = (data) => { ); -} +}; export default function M3URefreshNotification() { const playlists = usePlaylistsStore((s) => s.playlists); const refreshProgress = usePlaylistsStore((s) => s.refreshProgress); const fetchStreams = useStreamsStore((s) => s.fetchStreams); const fetchChannelGroups = useChannelsStore((s) => s.fetchChannelGroups); - const fetchChannels = useChannelsStore((s) => s.fetchChannels); + const fetchChannelIds = useChannelsStore((s) => s.fetchChannelIds); const fetchPlaylists = usePlaylistsStore((s) => s.fetchPlaylists); const fetchEPGData = useEPGsStore((s) => s.fetchEPGData); const fetchCategories = useVODStore((s) => s.fetchCategories); @@ -69,7 +69,7 @@ export default function M3URefreshNotification() { } // Update notification status - setNotificationStatus(prev => ({ + setNotificationStatus((prev) => ({ ...prev, [data.account]: data, })); @@ -134,7 +134,7 @@ export default function M3URefreshNotification() { if (action == 'parsing') { fetchStreams(); API.requeryChannels(); - fetchChannels(); + fetchChannelIds(); } else if (action == 'processing_groups') { fetchStreams(); fetchChannelGroups(); @@ -148,9 +148,10 @@ export default function M3URefreshNotification() { const handleProgressNotification = (playlist, data) => { const baseMessage = getActionMessage(data.action); - const message = data.progress == 0 - ? `${baseMessage} starting...` - : `${baseMessage} complete!`; + const message = + data.progress == 0 + ? `${baseMessage} starting...` + : `${baseMessage} complete!`; if (data.progress == 100) { triggerPostCompletionFetches(data.action); diff --git a/frontend/src/components/__tests__/M3URefreshNotification.test.jsx b/frontend/src/components/__tests__/M3URefreshNotification.test.jsx index 14be3a7f..2c5a5572 100644 --- a/frontend/src/components/__tests__/M3URefreshNotification.test.jsx +++ b/frontend/src/components/__tests__/M3URefreshNotification.test.jsx @@ -61,9 +61,7 @@ vi.mock('lucide-react', () => ({ })); const renderWithProviders = (component) => { - return render( - {component} - ); + return render({component}); }; describe('M3URefreshNotification', () => { @@ -96,7 +94,7 @@ describe('M3URefreshNotification', () => { mockChannelsStore = { fetchChannelGroups: vi.fn(), - fetchChannels: vi.fn(), + fetchChannelIds: vi.fn(), }; mockEPGsStore = { @@ -107,9 +105,15 @@ describe('M3URefreshNotification', () => { fetchCategories: vi.fn(), }; - usePlaylistsStore.mockImplementation((selector) => selector(mockPlaylistsStore)); - useStreamsStore.mockImplementation((selector) => selector(mockStreamsStore)); - useChannelsStore.mockImplementation((selector) => selector(mockChannelsStore)); + usePlaylistsStore.mockImplementation((selector) => + selector(mockPlaylistsStore) + ); + useStreamsStore.mockImplementation((selector) => + selector(mockStreamsStore) + ); + useChannelsStore.mockImplementation((selector) => + selector(mockChannelsStore) + ); useEPGsStore.mockImplementation((selector) => selector(mockEPGsStore)); useVODStore.mockImplementation((selector) => selector(mockVODStore)); }); @@ -231,7 +235,7 @@ describe('M3URefreshNotification', () => { expect(showNotification).toHaveBeenCalled(); expect(mockStreamsStore.fetchStreams).toHaveBeenCalled(); expect(API.requeryChannels).toHaveBeenCalled(); - expect(mockChannelsStore.fetchChannels).toHaveBeenCalled(); + expect(mockChannelsStore.fetchChannelIds).toHaveBeenCalled(); }); }); }); @@ -483,7 +487,7 @@ describe('M3URefreshNotification', () => { rerender( - + ); @@ -569,7 +573,7 @@ describe('M3URefreshNotification', () => { // Re-render with same data rerender( - + ); @@ -606,7 +610,7 @@ describe('M3URefreshNotification', () => { rerender( - + ); @@ -648,7 +652,7 @@ describe('M3URefreshNotification', () => { rerender( - + ); @@ -687,7 +691,7 @@ describe('M3URefreshNotification', () => { rerender( - + ); @@ -704,7 +708,7 @@ describe('M3URefreshNotification', () => { rerender( - + ); });