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
@@ -5,8 +5,14 @@ import type { LidarrConfig } from '$lib/api/types';
import type { CoverProvider, SMTPConfig } from '$lib/api/admin';
// useQueryClient is wrapped so the page can call invalidateQueries() without
// a real QueryClient context. Everything else from svelte-query passes through.
// a real QueryClient context. Per-file mock OVERRIDES the vitest.setup default
// so assertions see this named spy rather than the setup's anonymous fn.
const invalidateQueries = vi.fn();
vi.mock('@tanstack/svelte-query', async (orig) => {
const actual = (await orig()) as Record<string, unknown>;
return { ...actual, useQueryClient: () => ({ invalidateQueries }) };
});
vi.mock('$lib/api/admin', () => ({
createLidarrConfigQuery: vi.fn(),
createQualityProfilesQuery: vi.fn(),