Skip to content

Commit

Permalink
test(lido): fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
mymphe committed Feb 12, 2024
1 parent bd712e9 commit cc2f3e3
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion test/0.4.24/lido/lido.staking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { mine } from "@nomicfoundation/hardhat-network-helpers";

import { ACL, Lido } from "typechain-types";

import { deployLidoDao, ether } from "lib";
import { deployLidoDao, ether, ONE_ETHER } from "lib";

describe("Lido:staking", () => {
let deployer: HardhatEthersSigner;
Expand Down Expand Up @@ -177,4 +177,37 @@ describe("Lido:staking", () => {
}
});
});

context("fallback", () => {
beforeEach(async () => {
await lido.resumeStaking();
});

it("Defaults to submit", async () => {
await expect(
user.sendTransaction({
to: await lido.getAddress(),
value: ONE_ETHER,
}),
)
.to.emit(lido, "Submitted")
.withArgs(user.address, ONE_ETHER, ZeroAddress)
.and.to.emit(lido, "Transfer")
.withArgs(ZeroAddress, user.address, ONE_ETHER)
.and.to.emit(lido, "TransferShares")
.withArgs(ZeroAddress, user.address, ONE_ETHER);

expect(await lido.balanceOf(user)).to.equal(ONE_ETHER);
});

it("Reverts when tx data is not empty", async () => {
await expect(
user.sendTransaction({
to: await lido.getAddress(),
value: ONE_ETHER,
data: "0x01",
}),
).to.be.revertedWith("NON_EMPTY_DATA");
});
});
});

0 comments on commit cc2f3e3

Please sign in to comment.