diff --git a/tests/hooks/useTuitioClient.test.ts b/tests/hooks/useTuitioClient.test.ts index fc2181d..c91c7b0 100644 --- a/tests/hooks/useTuitioClient.test.ts +++ b/tests/hooks/useTuitioClient.test.ts @@ -1,5 +1,5 @@ import { renderHook, act } from "@testing-library/react-hooks"; -import { TuitioClient } from "@flare/tuitio-client"; +import { TuitioClient, invalidate } from "@flare/tuitio-client"; import { useTuitioClient } from "../../src/hooks"; jest.mock("@flare/tuitio-client", () => ({ @@ -81,4 +81,20 @@ describe("useTuitioClient", () => { "user" ); }); + + it("should call invalidate when logout is called", () => { + const { result } = renderHook(() => + useTuitioClient({ + onLoginSuccess: jest.fn(), + onLoginFailed: jest.fn(), + onLoginError: jest.fn() + }) + ); + + act(() => { + result.current.logout(); + }); + + expect(invalidate).toHaveBeenCalled(); + }); });