Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
Fix test to expect SafeERC20 error
Browse files Browse the repository at this point in the history
  • Loading branch information
stevieraykatz committed Oct 2, 2023
1 parent 0224333 commit bd24941
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/integrations/flux/FluxStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,19 @@ describe("FluxStrategy", function () {
it("reverts if the baseToken transfer fails", async function () {
await wait(baseToken.mint(await owner.getAddress(), 1));
await wait(baseToken.setTransferAllowed(false));
await expect(flux.deposit(1)).to.be.revertedWithCustomError(flux, "TransferFailed");
await expect(flux.deposit(1)).to.be.revertedWith(
"SafeERC20: ERC20 operation did not succeed"
);
await wait(baseToken.setTransferAllowed(true));
});
it("reverts if the baseToken approve fails", async function () {
await wait(baseToken.mint(await owner.getAddress(), 1));
await wait(baseToken.approve(flux.address, 1));
await wait(baseToken.setApproveAllowed(false));
await wait(yieldToken.setResponseAmt(1));
await expect(flux.deposit(1)).to.be.revertedWithCustomError(flux, "ApproveFailed");
await expect(flux.deposit(1)).to.be.revertedWith(
"SafeERC20: ERC20 operation did not succeed"
);
await wait(baseToken.setApproveAllowed(true));
});
it("reverts if the deposit fails", async function () {
Expand Down Expand Up @@ -216,7 +220,9 @@ describe("FluxStrategy", function () {
await wait(yieldToken.approve(flux.address, 1));
await wait(yieldToken.setResponseAmt(1));
await wait(baseToken.setApproveAllowed(false));
await expect(flux.withdraw(1)).to.be.revertedWithCustomError(flux, "ApproveFailed");
await expect(flux.withdraw(1)).to.be.revertedWith(
"SafeERC20: ERC20 operation did not succeed"
);
await wait(baseToken.setApproveAllowed(true));
});
it("correctly executes the redemption", async function () {
Expand Down

0 comments on commit bd24941

Please sign in to comment.