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