From c62125cf7bd181faf61e02a9e90efa2d0c6ebfdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=81=B5=E5=BA=94?= Date: Mon, 17 Aug 2026 14:53:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=BB=E5=8A=A8token=E5=88=B7?= =?UTF-8?q?=E6=96=B0-=E5=9C=A8=E8=BF=87=E6=9C=9F=E5=89=8D=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=BB=AD=E6=9C=9F=E9=81=BF=E5=85=8D401=E9=94=99?= =?UTF-8?q?=E8=AF=AF=20(#1385)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/test/hooks/useAuth.test.tsx | 29 +++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/apps/web/src/test/hooks/useAuth.test.tsx b/apps/web/src/test/hooks/useAuth.test.tsx index e517f81f9..9a0d0eb4b 100644 --- a/apps/web/src/test/hooks/useAuth.test.tsx +++ b/apps/web/src/test/hooks/useAuth.test.tsx @@ -31,14 +31,27 @@ vi.mock("react-router-dom", async () => { }) vi.mock("@/store/authStore", () => ({ - useAuthStore: (selector: any) => - selector({ - user: { id: "1", username: "testuser" }, - token: "mock-token", - isAuthenticated: true, - setAuth: mockSetAuth, - clearAuth: mockClearAuth, - }), + useAuthStore: Object.assign( + (selector: any) => + selector({ + user: { id: "1", username: "testuser" }, + token: "mock-token", + refreshToken: "mock-refresh-token", + isAuthenticated: true, + setAuth: mockSetAuth, + clearAuth: mockClearAuth, + }), + { + getState: () => ({ + user: { id: "1", username: "testuser" }, + token: "mock-token", + refreshToken: "mock-refresh-token", + isAuthenticated: true, + setAuth: mockSetAuth, + clearAuth: mockClearAuth, + }), + }, + ), })) vi.mock("@tanstack/react-query", () => ({