Skip to content

Instantly share code, notes, and snippets.

@piorot

piorot/index.ts Secret

Created March 29, 2022 11:07
Show Gist options
  • Save piorot/c0d00cc817d381ac09d438f003cb5658 to your computer and use it in GitHub Desktop.
Save piorot/c0d00cc817d381ac09d438f003cb5658 to your computer and use it in GitHub Desktop.
It should be possible to withdraw multiple times provided there were incomes in between
it("It should be possible to withdraw multiple times provided there were incomes in between", 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 Bob.sendTransaction({
to: apartment.address,
value: ethers.utils.parseEther("1")
});
await expect(apartment.connect(Alice).withdraw()).not.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