29 lines
978 B
TypeScript
29 lines
978 B
TypeScript
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);
|
|
});
|
|
});
|