Rename fetchChannels to fetchChannelIds in M3URefreshNotification component and tests

This commit is contained in:
SergeantPanda 2026-03-06 14:51:34 -06:00
parent 062022b873
commit d39b077715
2 changed files with 28 additions and 23 deletions

View file

@ -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 (
<Stack>
@ -41,14 +41,14 @@ const M3uSetupSuccess = (data) => {
</Group>
</Stack>
);
}
};
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);

View file

@ -61,9 +61,7 @@ vi.mock('lucide-react', () => ({
}));
const renderWithProviders = (component) => {
return render(
<BrowserRouter>{component}</BrowserRouter>
);
return render(<BrowserRouter>{component}</BrowserRouter>);
};
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(
<BrowserRouter>
<M3URefreshNotification />
<M3URefreshNotification />
</BrowserRouter>
);
@ -569,7 +573,7 @@ describe('M3URefreshNotification', () => {
// Re-render with same data
rerender(
<BrowserRouter>
<M3URefreshNotification />
<M3URefreshNotification />
</BrowserRouter>
);
@ -606,7 +610,7 @@ describe('M3URefreshNotification', () => {
rerender(
<BrowserRouter>
<M3URefreshNotification />
<M3URefreshNotification />
</BrowserRouter>
);
@ -648,7 +652,7 @@ describe('M3URefreshNotification', () => {
rerender(
<BrowserRouter>
<M3URefreshNotification />
<M3URefreshNotification />
</BrowserRouter>
);
@ -687,7 +691,7 @@ describe('M3URefreshNotification', () => {
rerender(
<BrowserRouter>
<M3URefreshNotification />
<M3URefreshNotification />
</BrowserRouter>
);
@ -704,7 +708,7 @@ describe('M3URefreshNotification', () => {
rerender(
<BrowserRouter>
<M3URefreshNotification />
<M3URefreshNotification />
</BrowserRouter>
);
});