mirror of
https://github.com/bitwarden/browser
synced 2025-12-29 06:33:40 +00:00
[EC-281] Add de/serialization methods to CipherView objects (#2970)
This commit is contained in:
17
libs/common/spec/models/view/attachmentView.spec.ts
Normal file
17
libs/common/spec/models/view/attachmentView.spec.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { SymmetricCryptoKey } from "@bitwarden/common/models/domain/symmetricCryptoKey";
|
||||
import { AttachmentView } from "@bitwarden/common/models/view/attachmentView";
|
||||
|
||||
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);
|
||||
|
||||
const actual = AttachmentView.fromJSON({
|
||||
key: "encKeyB64" as any,
|
||||
});
|
||||
|
||||
expect(actual.key).toEqual("encKeyB64_fromJSON");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user