Skip to content

Commit

Permalink
fix: updating tests to coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
EDUARDO MELO DE SIQUEIRA authored and EDUARDO MELO DE SIQUEIRA committed Jul 12, 2024
1 parent f136cc8 commit a41fc47
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions test/OriumSftMarketplace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,65 @@ describe('OriumSftMarketplace', () => {
.batchRevokeRole([1], [UNIQUE_ROLE], [borrower.address], [await wearableToken.getAddress()]),
).to.be.revertedWith('OriumSftMarketplace: role is not revocable Legacy')
})
it('Should NOT batch revoke role if if role is expired', async () => {
await rolesRegistry
.connect(lender)
.grantRole(
1,
UNIQUE_ROLE,
borrower.address,
Number((await ethers.provider.getBlock('latest'))?.timestamp) + ONE_DAY,
false,
EMPTY_BYTES,
)
await rolesRegistry
.connect(borrower)
.setRoleApprovalForAll(await mockERC1155.getAddress(), await marketplace.getAddress(), true)
await time.increase(ONE_DAY)
await expect(
marketplace
.connect(lender)
.batchRevokeRole([1], [UNIQUE_ROLE], [borrower.address], [await mockERC1155.getAddress()]),
).to.be.revertedWith('OriumSftMarketplace: role is expired')
})
it('Should NOT batch LEGACY revoke role if role is expired', async () => {
await marketplaceRoyalties
.connect(operator)
.setRolesRegistry(await wearableToken.getAddress(), await SftRolesRegistrySingleRoleLegacy.getAddress())
await wearableToken.setApprovalForAll(await SftRolesRegistrySingleRoleLegacy.getAddress(), true)

commitAndGrantRoleParams[0].tokenAddress = await wearableToken.getAddress()

await SftRolesRegistrySingleRoleLegacy.connect(lender).setRoleApprovalForAll(
await wearableToken.getAddress(),
await marketplace.getAddress(),
true,
)
await wearableToken
.connect(lender)
.setApprovalForAll(await SftRolesRegistrySingleRoleLegacy.getAddress(), true)
expect(marketplace.connect(lender).batchCommitTokensAndGrantRole(commitAndGrantRoleParams))

await SftRolesRegistrySingleRoleLegacy.connect(lender).grantRole(
1,
UNIQUE_ROLE,
borrower.address,
Number((await ethers.provider.getBlock('latest'))?.timestamp) + ONE_DAY,
false,
EMPTY_BYTES,
)
await SftRolesRegistrySingleRoleLegacy.connect(borrower).setRoleApprovalForAll(
await wearableToken.getAddress(),
await marketplace.getAddress(),
true,
)
await time.increase(ONE_DAY)
await expect(
marketplace
.connect(lender)
.batchRevokeRole([1], [UNIQUE_ROLE], [borrower.address], [await wearableToken.getAddress()]),
).to.be.revertedWith('OriumSftMarketplace: role is expired')
})
})
})
})
Expand Down

0 comments on commit a41fc47

Please sign in to comment.