fix(web/test): restore named-mock svelte-query overrides B3 stripped (integrations + requests)

This commit is contained in:
2026-05-08 11:26:19 -04:00
parent 5a174c9ef0
commit 47c316e211
2 changed files with 13 additions and 2 deletions
+6 -1
View File
@@ -4,8 +4,13 @@ import { mockQuery } from '../../test-utils/query';
import type { LidarrRequest } from '$lib/api/types';
// Capture invalidateQueries on the mocked QueryClient so the cancel test can
// assert against the same instance the page consumed.
// assert against the same instance the page consumed. Per-file mock OVERRIDES
// the vitest.setup default so assertions see this named spy.
const invalidateQueries = vi.fn().mockResolvedValue(undefined);
vi.mock('@tanstack/svelte-query', async (orig) => {
const actual = (await orig()) as Record<string, unknown>;
return { ...actual, useQueryClient: () => ({ invalidateQueries }) };
});
vi.mock('$lib/api/requests', () => ({
createMyRequestsQuery: vi.fn(),