1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-30 08:10:34 +01:00
bitwarden-browser/libs/common/spec/models/view/loginView.spec.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
850 B
TypeScript
Raw Normal View History

import { LoginUriView } from "@bitwarden/common/models/view/login-uri.view";
import { LoginView } from "@bitwarden/common/models/view/login.view";
import { mockFromJson } from "../../utils";
jest.mock("@bitwarden/common/models/view/login-uri.view");
describe("LoginView", () => {
beforeEach(() => {
(LoginUriView as any).mockClear();
});
it("fromJSON initializes nested objects", () => {
jest.spyOn(LoginUriView, "fromJSON").mockImplementation(mockFromJson);
const passwordRevisionDate = new Date();
const actual = LoginView.fromJSON({
passwordRevisionDate: passwordRevisionDate.toISOString(),
uris: ["uri1", "uri2", "uri3"] as any,
});
expect(actual).toMatchObject({
passwordRevisionDate: passwordRevisionDate,
uris: ["uri1_fromJSON", "uri2_fromJSON", "uri3_fromJSON"],
});
});
});