mirror of
https://github.com/bitwarden/browser
synced 2026-01-05 18:13:26 +00:00
Assign ownership to many of the remaining libs/common files. Criteria for ownership: * Files used by a single team, is now owned by that team. * Files related to a domain owned by a team is now owned by that team. * Where ownership is unclear the "lowest level" service takes ownership.
54 lines
1.1 KiB
TypeScript
54 lines
1.1 KiB
TypeScript
import { SecureNoteType } from "../../enums";
|
|
import { SecureNoteData } from "../data/secure-note.data";
|
|
|
|
import { SecureNote } from "./secure-note";
|
|
|
|
describe("SecureNote", () => {
|
|
let data: SecureNoteData;
|
|
|
|
beforeEach(() => {
|
|
data = {
|
|
type: SecureNoteType.Generic,
|
|
};
|
|
});
|
|
|
|
it("Convert from empty", () => {
|
|
const data = new SecureNoteData();
|
|
const secureNote = new SecureNote(data);
|
|
|
|
expect(secureNote).toEqual({
|
|
type: undefined,
|
|
});
|
|
});
|
|
|
|
it("Convert", () => {
|
|
const secureNote = new SecureNote(data);
|
|
|
|
expect(secureNote).toEqual({
|
|
type: 0,
|
|
});
|
|
});
|
|
|
|
it("toSecureNoteData", () => {
|
|
const secureNote = new SecureNote(data);
|
|
expect(secureNote.toSecureNoteData()).toEqual(data);
|
|
});
|
|
|
|
it("Decrypt", async () => {
|
|
const secureNote = new SecureNote();
|
|
secureNote.type = SecureNoteType.Generic;
|
|
|
|
const view = await secureNote.decrypt(null);
|
|
|
|
expect(view).toEqual({
|
|
type: 0,
|
|
});
|
|
});
|
|
|
|
describe("fromJSON", () => {
|
|
it("returns null if object is null", () => {
|
|
expect(SecureNote.fromJSON(null)).toBeNull();
|
|
});
|
|
});
|
|
});
|