diff --git a/tests/InitialState.test.ts b/tests/InitialState.test.ts new file mode 100644 index 0000000..e44b93c --- /dev/null +++ b/tests/InitialState.test.ts @@ -0,0 +1,28 @@ +import { initialDispatchActions } from "../src/initialState"; +import { TuitioToken } from "@flare/tuitio-client"; + +describe("Initial dispatch actions", () => { + it("should have a property `onLoginSuccess` that is a function", () => { + expect(initialDispatchActions.onLoginSuccess).toBeInstanceOf(Function); + }); + + it("should have a property `onLogout` that is a function", () => { + expect(initialDispatchActions.onLogout).toBeInstanceOf(Function); + }); + + it("onLoginSuccess function must return undefined", () => { + const mockToken: TuitioToken = { + raw: "abc123", + validFrom: new Date("2023-01-01T00:00:00.000Z"), + validUntil: new Date("2023-12-31T23:59:59.999Z") + }; + + const result = initialDispatchActions.onLoginSuccess(mockToken, "user"); + expect(result).toBe(undefined); + }); + + it("onLogout function must return undefined", () => { + const result = initialDispatchActions.onLogout(); + expect(result).toBe(undefined); + }); +});