Skip to content

Instantly share code, notes, and snippets.

@piorot

piorot/index.ts Secret

Created March 29, 2022 10:57
Show Gist options
  • Save piorot/67a2939e4232c2d9cf2b74b38ced10ba to your computer and use it in GitHub Desktop.
Save piorot/67a2939e4232c2d9cf2b74b38ced10ba to your computer and use it in GitHub Desktop.
Attempt to withdraw by non shareholder should be reverted
it("Attempt to withdraw by non shareholder should be reverted", 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 expect(apartment.connect(Bob).withdraw()).to.be.revertedWith("unauthorized");
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment