mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-27 08:14:33 +08:00
test(providers): add mocks for failover hooks in ProviderList tests
This commit is contained in:
@@ -79,6 +79,22 @@ vi.mock("@dnd-kit/sortable", async () => {
|
||||
};
|
||||
});
|
||||
|
||||
// Mock hooks that use QueryClient
|
||||
vi.mock("@/hooks/useStreamCheck", () => ({
|
||||
useStreamCheck: () => ({
|
||||
checkProvider: vi.fn(),
|
||||
isChecking: () => false,
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("@/lib/query/failover", () => ({
|
||||
useAutoFailoverEnabled: () => ({ data: false }),
|
||||
useFailoverQueue: () => ({ data: [] }),
|
||||
useAddToFailoverQueue: () => ({ mutate: vi.fn() }),
|
||||
useRemoveFromFailoverQueue: () => ({ mutate: vi.fn() }),
|
||||
useReorderFailoverQueue: () => ({ mutate: vi.fn() }),
|
||||
}));
|
||||
|
||||
function createProvider(overrides: Partial<Provider> = {}): Provider {
|
||||
return {
|
||||
id: overrides.id ?? "provider-1",
|
||||
|
||||
Reference in New Issue
Block a user