Skip to content

Commit

Permalink
MAt-6744 added test case
Browse files Browse the repository at this point in the history
  • Loading branch information
sb-prateekkeerthi committed Mar 8, 2024
1 parent 98eba63 commit 20a6483
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/util/useCheckCanDelete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand All @@ -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();
});
});
2 changes: 1 addition & 1 deletion src/util/useCheckCanDelete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 20a6483

Please sign in to comment.