tuitio-client-react/tests/initialState.test.ts

25 lines
884 B
TypeScript

import { initialDispatchActions } from "../src/initialState";
describe("Initial dispatch actions", () => {
it("should have a property `onLoginSuccess` that is a function", () => {
expect(initialDispatchActions.onLoginSuccess).toBeInstanceOf(Function);
});
it("should have a property `onLogoutSuccess` that is a function", () => {
expect(initialDispatchActions.onLogoutSuccess).toBeInstanceOf(Function);
});
it("onLoginSuccess function must return undefined", () => {
const mockToken = "abc123";
const validUntil = new Date("2023-12-31T23:59:59.999Z");
const result = initialDispatchActions.onLoginSuccess(mockToken, validUntil, "user");
expect(result).toBe(undefined);
});
it("onLogoutSuccess function must return undefined", () => {
const result = initialDispatchActions.onLogoutSuccess();
expect(result).toBe(undefined);
});
});