From 98eba63fa6f4c22ebad2945e7ba8afdff8447190 Mon Sep 17 00:00:00 2001 From: Prateek Keerthi Date: Fri, 8 Mar 2024 17:08:00 -0500 Subject: [PATCH] MAt-6744 added test case --- src/util/useCheckCanDelete.test.ts | 45 ++---------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/src/util/useCheckCanDelete.test.ts b/src/util/useCheckCanDelete.test.ts index 96614aa..997db38 100644 --- a/src/util/useCheckCanDelete.test.ts +++ b/src/util/useCheckCanDelete.test.ts @@ -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(); - // }); });