mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
* [deps] Autofill: Update prettier to v3 * prettier formatting updates --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
32 lines
883 B
TypeScript
32 lines
883 B
TypeScript
import { Account } from "./account";
|
|
import { State } from "./state";
|
|
|
|
describe("state", () => {
|
|
describe("fromJSON", () => {
|
|
it("should deserialize to an instance of itself", () => {
|
|
expect(State.fromJSON({}, () => new Account({}))).toBeInstanceOf(State);
|
|
});
|
|
|
|
it("should always assign an object to accounts", () => {
|
|
const state = State.fromJSON({}, () => new Account({}));
|
|
expect(state.accounts).not.toBeNull();
|
|
expect(state.accounts).toEqual({});
|
|
});
|
|
|
|
it("should build an account map", () => {
|
|
const accountsSpy = jest.spyOn(Account, "fromJSON");
|
|
const state = State.fromJSON(
|
|
{
|
|
accounts: {
|
|
userId: {},
|
|
},
|
|
},
|
|
Account.fromJSON,
|
|
);
|
|
|
|
expect(state.accounts["userId"]).toBeInstanceOf(Account);
|
|
expect(accountsSpy).toHaveBeenCalled();
|
|
});
|
|
});
|
|
});
|