initial state tests
parent
c8f7d86262
commit
b3c11f445a
|
@ -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);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue