1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-22 11:13:46 +00:00

[EC-582] Add domain object serialization (#3623)

This commit is contained in:
Thomas Rittson
2022-10-04 06:50:43 +10:00
committed by GitHub
parent cb7b8313a4
commit 162db0b600
25 changed files with 513 additions and 16 deletions

View File

@@ -1,12 +1,13 @@
import { SymmetricCryptoKey } from "@bitwarden/common/models/domain/symmetricCryptoKey";
import { AttachmentView } from "@bitwarden/common/models/view/attachmentView";
import { mockFromJson } from "../../utils";
jest.mock("@bitwarden/common/models/domain/symmetricCryptoKey");
describe("AttachmentView", () => {
it("fromJSON initializes nested objects", () => {
const mockFromJson = (stub: string) => stub + "_fromJSON";
jest.spyOn(SymmetricCryptoKey, "fromJSON").mockImplementation(mockFromJson as any);
jest.spyOn(SymmetricCryptoKey, "fromJSON").mockImplementation(mockFromJson);
const actual = AttachmentView.fromJSON({
key: "encKeyB64" as any,