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 b368a9f commit 98eba63
Showing 1 changed file with 3 additions and 42 deletions.
45 changes: 3 additions & 42 deletions src/util/useCheckCanDelete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,52 +24,13 @@ describe("Check user canEdit", () => {
expect(canEdit).toBeTruthy();
});

it("should return true when user name and createdBy are the same", () => {
const canEdit = useCheckUserCanDelete(JANE_DOE, true);
expect(canEdit).toBeTruthy();
it("should return true when user name and createdBy are not the same", () => {
const canEdit = useCheckUserCanDelete(JOHN_DOE, true);
expect(canEdit).not.toBeTruthy();
});

it("should return false when user name and createdBy are same but it is not draft", () => {
const canEdit = useCheckUserCanDelete(JANE_DOE, false);
expect(canEdit).not.toBeTruthy();
});

// it("should return undefined when user name and createdBy are not the same", () => {
// const canEdit = useCheckUserCanEdit("anotherU$er", true);
// expect(canEdit).not.toBeTruthy();
// });

// it("should return true when measure is shared with the same user", () => {
// const canEdit = useCheckUserCanEdit(
// "anotherU$er", // nosec
// [{ userId: JANE_DOE, roles: ["SHARED_WITH"] }],
// true
// );
// expect(canEdit).toBeTruthy();
// });

// it("should return true when measure is shared with the same user with no version status supplied", () => {
// const canEdit = useCheckUserCanEdit("anotherU$er", [
// { userId: JANE_DOE, roles: ["SHARED_WITH"] },
// ]);
// expect(canEdit).toBeTruthy();
// });

// it("should return undefined when measure is shared with a different user", () => {
// const canEdit = useCheckUserCanEdit(
// "anotherU$er",
// [{ userId: JOHN_DOE, roles: ["SHARED_WITH"] }],
// true
// );
// expect(canEdit).not.toBeTruthy();
// });

// it("should return false when measure is versioned greater than 0", () => {
// const canEdit = useCheckUserCanEdit(
// "anotherU$er",
// [{ userId: JOHN_DOE, roles: ["SHARED_WITH"] }],
// false
// );
// expect(canEdit).not.toBeTruthy();
// });
});

0 comments on commit 98eba63

Please sign in to comment.