Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
We added a new role `owner` to the test fixture and we need to make sure
we call functions with correct staker account.
  • Loading branch information
r-czajkowski committed Dec 8, 2023
1 parent 7ae23cb commit a5d022c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions core/test/Acre.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,9 @@ describe("Acre", () => {
// Total assets = 7(staker A) + 3(staker B) + 5(yield) + 2(staker
// A) = 17
// Total shares = 7 + 3 + 1.(3) = 11.(3)
await acre.stake(newAmountToStake, staker1.address, referral)
await acre
.connect(staker1)
.stake(newAmountToStake, staker1.address, referral)
})

it("should receive more shares", async () => {
Expand Down Expand Up @@ -505,7 +507,7 @@ describe("Acre", () => {

it("should take into account the max total assets parameter and revert", async () => {
await expect(
acre.mint(sharesToMint, staker1.address),
acre.connect(staker1).mint(sharesToMint, staker1.address),
).to.be.revertedWithCustomError(acre, "ERC4626ExceededMaxMint")
})
})
Expand All @@ -520,11 +522,14 @@ describe("Acre", () => {
const previewDeposit = await acre.previewDeposit(minimumDepositAmount)

sharesToMint = previewDeposit - 1n
await tbtc
.connect(staker1)
.approve(await acre.getAddress(), minimumDepositAmount)
})

it("should take into account the min deposit amount parameter and revert", async () => {
await expect(
acre.mint(sharesToMint, staker1.address),
acre.connect(staker1).mint(sharesToMint, staker1.address),
).to.be.revertedWith("Amount is less than minimum")
})
},
Expand Down

0 comments on commit a5d022c

Please sign in to comment.