mirror of
https://dev.azure.com/tstanciu94/Packages/_git/tuitio-client-react
synced 2025-04-07 00:27:20 +03:00
initial state tests
This commit is contained in:
parent
c8f7d86262
commit
b3c11f445a
28
tests/InitialState.test.ts
Normal file
28
tests/InitialState.test.ts
Normal file
@ -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…
x
Reference in New Issue
Block a user