Skip to content

Instantly share code, notes, and snippets.

@piorot

piorot/index.ts Secret

Created March 29, 2022 11:05
Show Gist options
  • Save piorot/0af9c0268b5376672a3ee21e83d93e05 to your computer and use it in GitHub Desktop.
Save piorot/0af9c0268b5376672a3ee21e83d93e05 to your computer and use it in GitHub Desktop.
It should not be possible to withdraw more than one should
it("It should not be possible to withdraw more than one should", async () => {
const Apartment = await ethers.getContractFactory("Apartment");
const apartment = await Apartment.deploy();
[owner, Alice, Bob] = await ethers.getSigners();
await apartment.deployed();
await apartment.transfer(Alice.address, 20);
await Bob.sendTransaction({
to: apartment.address,
value: ethers.utils.parseEther("1")
});
await apartment.connect(Alice).withdraw();
await expect(apartment.connect(Alice).withdraw()).to.be.revertedWith("0 funds to withdraw");
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment