Skip to content

Commit cfb3218

Browse files
initialize id in folder constructor. fix failing tests
1 parent ab47d10 commit cfb3218

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

libs/common/src/vault/models/domain/folder.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ describe("Folder", () => {
6060
it("initializes empty properties when no FolderData is provided", () => {
6161
const folder = new Folder();
6262

63-
expect(folder.id).toBe(undefined);
64-
expect(folder.name).toBe(undefined);
63+
expect(folder.id).toBe("");
64+
expect(folder.name).toBeInstanceOf(EncString);
6565
expect(folder.revisionDate).toBeInstanceOf(Date);
6666
});
6767
});
@@ -74,7 +74,7 @@ describe("Folder", () => {
7474
const revisionDate = new Date("2022-08-04T01:06:40.441Z");
7575
const actual = Folder.fromJSON({
7676
revisionDate: revisionDate.toISOString(),
77-
name: "name",
77+
name: "name_fromJSON",
7878
id: "id",
7979
});
8080

libs/common/src/vault/models/domain/folder.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class Folder extends Domain {
1818
return;
1919
}
2020

21+
this.id = obj.id;
2122
this.name = new EncString(obj.name);
2223
this.revisionDate = new Date(obj.revisionDate);
2324
}

0 commit comments

Comments
 (0)