mirror of
https://github.com/teamhanko/hanko.git
synced 2025-10-28 06:37:57 +08:00
23 lines
803 B
TypeScript
23 lines
803 B
TypeScript
import { decodedLSContent } from "../../setup";
|
|
import { UserState } from "../../../src/lib/state/UserState";
|
|
|
|
describe("userState.getUserState()", () => {
|
|
it("should return the user state when local storage is initialized", async () => {
|
|
const ls = decodedLSContent();
|
|
const state = new (class extends UserState {})();
|
|
const userID = Object.keys(decodedLSContent().users)[0];
|
|
|
|
state.ls = decodedLSContent();
|
|
expect(state.getUserState(userID)).toEqual(ls.users[userID]);
|
|
});
|
|
|
|
it("should return the user state when local storage is uninitialized", async () => {
|
|
const ls = decodedLSContent();
|
|
const state = new (class extends UserState {})();
|
|
const userID = Object.keys(ls.users)[0];
|
|
|
|
state.ls = {};
|
|
expect(state.getUserState(userID)).toEqual({});
|
|
});
|
|
});
|