Skip to content

Commit

Permalink
ON-476: Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Lima committed Sep 18, 2023
1 parent 9cc14bc commit 49bd7bd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/ERC7432.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ describe('ERC7432', () => {
await expect(ERC7432.connect(grantor).revokeRole(PROPERTY_MANAGER, AddressZero, tokenId, grantor.address))
.to.emit(ERC7432, 'RoleRevoked')
.withArgs(PROPERTY_MANAGER, AddressZero, tokenId, grantor.address, grantor.address)
expect(await ERC7432.hasRole(PROPERTY_MANAGER, AddressZero, tokenId, grantor.address, grantor.address)).to.be.equal(false)
})
it('should NOT revoke role if role is not revocable', async () => {
await ERC7432.connect(grantor).grantRole(
Expand Down Expand Up @@ -469,6 +470,22 @@ describe('ERC7432', () => {
),
).to.be.revertedWith('ERC7432: sender must be approved')
})
it('should revoke role from if operator is approved by grantee', async () => {
await ERC7432.connect(userOne).approveRole(AddressZero, tokenId, operator.address, true)
expect(await ERC7432.hasRole(PROPERTY_MANAGER, AddressZero, tokenId, grantor.address, userOne.address)).to.be.equal(true)
await expect(
ERC7432.connect(operator).revokeRoleFrom(
PROPERTY_MANAGER,
AddressZero,
tokenId,
grantor.address,
userOne.address,
),
)
.to.emit(ERC7432, 'RoleRevoked')
.withArgs(PROPERTY_MANAGER, AddressZero, tokenId, grantor.address, userOne.address)
expect(await ERC7432.hasRole(PROPERTY_MANAGER, AddressZero, tokenId, grantor.address, userOne.address)).to.be.equal(false)
})
})
})
}
Expand Down

0 comments on commit 49bd7bd

Please # to comment.