Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

test(views/login): mock useQueryClient to fix No QueryClient error

Naiyuan Qing3f13605b4ca2
diff --git a/packages/views/auth/login-page.test.tsx b/packages/views/auth/login-page.test.tsx
index 000503e00b..0e9c0ed5f4 100644
--- a/packages/views/auth/login-page.test.tsx
+++ b/packages/views/auth/login-page.test.tsx
@@ -13,6 +13,14 @@ const mockApiListWorkspaces = vi.hoisted(() => vi.fn());
const mockApiVerifyCode = vi.hoisted(() => vi.fn());
const mockApiSetToken = vi.hoisted(() => vi.fn());
const mockApiGetMe = vi.hoisted(() => vi.fn());
+const mockSetQueryData = vi.hoisted(() => vi.fn());
+
+vi.mock("@tanstack/react-query", async () => {
+ const actual = await vi.importActual<typeof import("@tanstack/react-query")>(
+ "@tanstack/react-query",
+ );
+ return { ...actual, useQueryClient: () => ({ setQueryData: mockSetQueryData }) };
+});
vi.mock("@multica/core/auth", () => ({
useAuthStore: Object.assign(