Skip to content

Commit 8c07a69

Browse files
pxrlnicholaspai
authored andcommitted
improve: Prepare AD Admin test for updates (#46)
A pending change will revert on amount=0. This breaks a few tests, so prepare updates for those in advance.
1 parent 7d0560b commit 8c07a69

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

test/AcceleratingDistributor.Admin.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,13 @@ describe("AcceleratingDistributor: Admin Functions", async function () {
143143
});
144144

145145
it("Permissioning on staking-related methods", async function () {
146-
await expect(distributor.connect(owner).stake(lpToken1.address, 0)).to.be.revertedWith("stakedToken not enabled");
147-
await expect(distributor.connect(owner).unstake(lpToken1.address, 0)).to.be.revertedWith(
146+
await lpToken1.mint(owner.address, toWei(69));
147+
await lpToken1.connect(owner).approve(distributor.address, toWei(69));
148+
149+
await expect(distributor.connect(owner).stake(lpToken1.address, toWei(1))).to.be.revertedWith(
150+
"stakedToken not enabled"
151+
);
152+
await expect(distributor.connect(owner).unstake(lpToken1.address, toWei(1))).to.be.revertedWith(
148153
"stakedToken not initialized"
149154
);
150155
await expect(distributor.connect(owner).withdrawReward(lpToken1.address)).to.be.revertedWith(
@@ -160,11 +165,13 @@ describe("AcceleratingDistributor: Admin Functions", async function () {
160165
secondsToMaxMultiplier
161166
);
162167

163-
await expect(distributor.connect(owner).stake(lpToken1.address, 0)).to.not.be.reverted;
164-
await expect(distributor.connect(owner).unstake(lpToken1.address, 0)).to.not.be.reverted;
168+
await expect(distributor.connect(owner).stake(lpToken1.address, toWei(2))).to.not.be.reverted;
169+
await expect(distributor.connect(owner).unstake(lpToken1.address, toWei(1))).to.not.be.reverted;
165170
await expect(distributor.connect(owner).withdrawReward(lpToken1.address)).to.not.be.reverted;
166171
await expect(distributor.connect(owner).exit(lpToken1.address)).to.not.be.reverted;
167172

173+
// Balance => non-zero before disabling, to verify that unstake/withdraw/exit is still possible.
174+
await expect(distributor.connect(owner).stake(lpToken1.address, toWei(2))).to.not.be.reverted;
168175
await distributor.configureStakingToken(
169176
lpToken1.address,
170177
false,
@@ -173,8 +180,10 @@ describe("AcceleratingDistributor: Admin Functions", async function () {
173180
secondsToMaxMultiplier
174181
);
175182

176-
await expect(distributor.connect(owner).stake(lpToken1.address, 0)).to.be.revertedWith("stakedToken not enabled");
177-
await expect(distributor.connect(owner).unstake(lpToken1.address, 0)).to.not.be.reverted;
183+
await expect(distributor.connect(owner).stake(lpToken1.address, toWei(1))).to.be.revertedWith(
184+
"stakedToken not enabled"
185+
);
186+
await expect(distributor.connect(owner).unstake(lpToken1.address, toWei(1))).to.not.be.reverted;
178187
await expect(distributor.connect(owner).withdrawReward(lpToken1.address)).to.not.be.reverted;
179188
await expect(distributor.connect(owner).exit(lpToken1.address)).to.not.be.reverted;
180189
});

0 commit comments

Comments
 (0)