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

27 lines
921 B
TypeScript
Raw Normal View History

2023-03-18 15:54:29 +02:00
// Copyright (c) 2023 Tudor Stanciu
2023-02-11 21:44:41 +02:00
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);
2023-02-11 21:44:41 +02:00
});
it("onLoginSuccess function must return undefined", () => {
const mockToken = "abc123";
const validUntil = new Date("2023-12-31T23:59:59.999Z");
2023-02-11 21:44:41 +02:00
const result = initialDispatchActions.onLoginSuccess(mockToken, validUntil, "user");
2023-02-11 21:44:41 +02:00
expect(result).toBe(undefined);
});
it("onLogoutSuccess function must return undefined", () => {
const result = initialDispatchActions.onLogoutSuccess();
2023-02-11 21:44:41 +02:00
expect(result).toBe(undefined);
});
});