1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-05 23:53:21 +00:00
Files
directory-connector/jslib/common/spec/domain/folder.spec.ts
Addison Beck c259962279 [AC-1743] pt. 1: Unpackage-ify jslib (#374)
* Unpackage-ify jslib

* Adjust .tsconfig path for root and apply to jslib

* Rebuild package-lock.json

* Disable husky in CI

* Revert an incorrect find/replace

* Add jslib/shared/.eslintrc rules to root eslintrc

* Revert package.json change to ignore spec files when linting

* Ensure custom matcher gets imported in jslib tests

* Fix small workflow bugs from merging

* Try and get CI builds moving again

* Always sign and notorize builds in CI

* Revert erroneous verion bump
2023-12-20 11:33:33 -05:00

43 lines
1000 B
TypeScript

import { FolderData } from "@/jslib/common/src/models/data/folderData";
import { Folder } from "@/jslib/common/src/models/domain/folder";
import { mockEnc } from "../utils";
describe("Folder", () => {
let data: FolderData;
beforeEach(() => {
data = {
id: "id",
userId: "userId",
name: "encName",
revisionDate: "2022-01-31T12:00:00.000Z",
};
});
it("Convert", () => {
const field = new Folder(data);
expect(field).toEqual({
id: "id",
name: { encryptedString: "encName", encryptionType: 0 },
revisionDate: new Date("2022-01-31T12:00:00.000Z"),
});
});
it("Decrypt", async () => {
const folder = new Folder();
folder.id = "id";
folder.name = mockEnc("encName");
folder.revisionDate = new Date("2022-01-31T12:00:00.000Z");
const view = await folder.decrypt();
expect(view).toEqual({
id: "id",
name: "encName",
revisionDate: new Date("2022-01-31T12:00:00.000Z"),
});
});
});