Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
YouStillAlive committed Mar 20, 2024
1 parent 76e894a commit 172d996
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/DispenserProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,25 @@ describe("Dispenser Provider tests", function () {
expect(await token.balanceOf(user.address)).to.equal(beforeBalance.add(amount))
})

it("should create lock if approved for all", async () => {
await lockDealNFT.connect(user).setApprovalForAll(owner.address, true)
const signatureData = [poolId, validTime, user.address, userData]
const signature = await createSignature(signer, signatureData)
await expect(
dispenserProvider.connect(owner).createLock(poolId, validTime, user.address, usersData, signature)
).to.not.reverted
await lockDealNFT.connect(user).setApprovalForAll(owner.address, false)
})

it("should create lock if approved for all", async () => {
await lockDealNFT.connect(signer).approve(owner.address, poolId)
const signatureData = [poolId, validTime, user.address, userData]
const signature = await createSignature(signer, signatureData)
await expect(
dispenserProvider.connect(owner).createLock(poolId, validTime, user.address, usersData, signature)
).to.not.reverted
})

it("should revert double creation", async () => {
const signatureData = [poolId, validTime, user.address, userData]
const signature = await createSignature(signer, signatureData)
Expand Down

0 comments on commit 172d996

Please sign in to comment.