mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-28 20:41:19 +00:00
fix(tests): mock global fetch and restore SDLineupManager useEffect guard
This commit is contained in:
parent
aa27fcc362
commit
60a61e78e3
2 changed files with 5 additions and 1 deletions
|
|
@ -82,7 +82,7 @@ const SDLineupManager = ({ sourceId }) => {
|
|||
}, [sourceId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (sourceId && sourceType === 'schedules_direct') {
|
||||
if (sourceId) {
|
||||
fetchActiveLineups();
|
||||
// Fetch country list from SD API per their recommendation to not hardcode
|
||||
fetch('https://json.schedulesdirect.org/20141201/available/countries')
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@ import { render, screen, fireEvent, waitFor } from '@testing-library/react';
|
|||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
|
||||
// ── Utility mocks ──────────────────────────────────────────────────────────────
|
||||
global.fetch = vi.fn().mockResolvedValue({
|
||||
json: () => Promise.resolve({}),
|
||||
});
|
||||
|
||||
vi.mock('../../api.js', () => ({
|
||||
default: {
|
||||
getSDLineups: vi.fn().mockResolvedValue([]),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue