feat(frontend): Implement reactive refresh interceptor

This commit is contained in:
Yunxiao Xu
2026-02-18 13:52:02 -08:00
parent 5adc826cfb
commit 7cc34ceb0b
2 changed files with 80 additions and 10 deletions

View File

@@ -83,4 +83,19 @@ describe("AuthService", () => {
await AuthService.logout()
expect(mockedApi.post).toHaveBeenCalledWith("/auth/logout")
})
it("successfully refreshes session", async () => {
const mockResponse = {
data: {
access_token: "new-fake-token",
token_type: "bearer",
},
}
mockedApi.post.mockResolvedValueOnce(mockResponse)
const result = await AuthService.refreshSession()
expect(mockedApi.post).toHaveBeenCalledWith("/auth/refresh")
expect(result.access_token).toBe("new-fake-token")
})
})