diff --git a/src/util/useCheckCanDelete.test.ts b/src/util/useCheckCanDelete.test.ts index 997db38..41bab19 100644 --- a/src/util/useCheckCanDelete.test.ts +++ b/src/util/useCheckCanDelete.test.ts @@ -19,12 +19,12 @@ describe("Check user canEdit", () => { })); }); - it("should return true when user name and createdBy are the same", () => { + it("should return true when user name and createdBy are the same and draft is true", () => { const canEdit = useCheckUserCanDelete(JANE_DOE, true); expect(canEdit).toBeTruthy(); }); - it("should return true when user name and createdBy are not the same", () => { + it("should return false when user name and createdBy are not the same", () => { const canEdit = useCheckUserCanDelete(JOHN_DOE, true); expect(canEdit).not.toBeTruthy(); }); @@ -33,4 +33,9 @@ describe("Check user canEdit", () => { const canEdit = useCheckUserCanDelete(JANE_DOE, false); expect(canEdit).not.toBeTruthy(); }); + + it("should return true when user name and createdBy are the same ", () => { + const canEdit = useCheckUserCanDelete(JANE_DOE); + expect(canEdit).toBeTruthy(); + }); }); diff --git a/src/util/useCheckCanDelete.ts b/src/util/useCheckCanDelete.ts index d620cb8..75e0cb6 100644 --- a/src/util/useCheckCanDelete.ts +++ b/src/util/useCheckCanDelete.ts @@ -6,7 +6,7 @@ const useCheckUserCanDelete = ( ): boolean => { const { getUserName } = useOktaTokens(); const userName = getUserName(); - // versioned measures/libraries can never be deleted . + // versioned measures/libraries can never be deleted. if (!draft) { return false; }