Skip to content

Commit

Permalink
feat: add tests for undelegate function
Browse files Browse the repository at this point in the history
  • Loading branch information
clauBv23 committed Sep 18, 2024
1 parent 4079f7d commit be6b087
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion packages/contracts/test/core/permission/permission-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ describe('Core: PermissionManager', function () {
).to.be.revertedWithCustomError(pm, 'FlagCanNotBeZero');
});

it('should revert if flags that dont exist are removed', async () => {
it("should revert if flags that don't exist are removed", async () => {
await pm.removeOwner(pm.address, ADMIN_PERMISSION_ID, GRANT_OWNER_FLAG);

await expect(
Expand Down Expand Up @@ -674,6 +674,27 @@ describe('Core: PermissionManager', function () {
.withArgs(otherSigner.address, 0, FULL_OWNER_FLAG);
});

it('should revert if flags to undelegate are not delegated', async () => {
const bob = signers[3];
await pm.delegatePermission(
pm.address,
ADMIN_PERMISSION_ID,
bob.address,
GRANT_OWNER_FLAG
);

await expect(
pm.undelegatePermission(
pm.address,
ADMIN_PERMISSION_ID,
bob.address,
FULL_OWNER_FLAG
)
)
.to.be.revertedWithCustomError(pm, 'InvalidFlagsForRemovalPassed')
.withArgs(GRANT_OWNER_FLAG, FULL_OWNER_FLAG);
});

it('should emit PermissionUndelegated and correctly update the flags', async () => {
await expect(
pm.undelegatePermission(
Expand Down

0 comments on commit be6b087

Please sign in to comment.