Skip to content

Commit

Permalink
separate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
novaknole committed Sep 24, 2024
1 parent bfd2f5c commit b16defb
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion packages/contracts/test/core/permission/permission-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ describe.only('Core: PermissionManager', function () {
await pm.connect(alice).grant(someWhere, someWhere, somePermissionId);
});

it('should still keep the other flag for delegatee if only one flag is used/depleted', async () => {
it('should still keep `REVOKE_OWNER_FLAG` for delegatee if only `GRANT_OWNER_FLAG` is used/depleted', async () => {
let owner = signers[3];
let alice = signers[4];

Expand Down Expand Up @@ -1578,6 +1578,35 @@ describe.only('Core: PermissionManager', function () {
.withArgs(someWhere, otherSigner.address, somePermissionId);
});

it('should still keep `GRANT_OWNER_FLAG` for delegatee if only `REVOKE_OWNER_FLAG` is used/depleted', async () => {
let owner = signers[3];
let alice = signers[4];

await pm.createPermission(someWhere, somePermissionId, owner.address, []);

// Alice became a delegate of `GRANT_OWNER_FLAG` on this permission
await pm
.connect(owner)
.delegatePermission(
someWhere,
somePermissionId,
alice.address,
FULL_OWNER_FLAG
);

await pm.connect(alice).revoke(someWhere, someWhere, somePermissionId);

let currentFlags = await pm.getFlags(
someWhere,
somePermissionId,
alice.address
);
expect(currentFlags).to.deep.equal([0, GRANT_OWNER_FLAG]);
await expect(
pm.connect(alice).grant(someWhere, someWhere, somePermissionId)
).to.not.be.reverted;
});

it('should revert if undelegate got called before revoke got called by the delegatee', async () => {
await pm
.connect(ownerSigner)
Expand Down

0 comments on commit b16defb

Please sign in to comment.