Skip to content

Commit

Permalink
feat: add revert test
Browse files Browse the repository at this point in the history
  • Loading branch information
yk-saito committed Nov 28, 2023
1 parent cea85dd commit a3b786c
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,13 @@ describe('ENS-Domain', () => {
deployTextFixture,
);

let txn;

const ownerBeforeBalance = await hre.ethers.provider.getBalance(
owner.address,
);
// スーパーコーダーとしてコントラクトから資金を奪おうとします。
try {
txn = await domainContract.connect(superCoder).withdraw();
await txn.wait();
} catch (error) {
console.log('robber could not withdraw token');
}

await expect(
domainContract.connect(superCoder).withdraw(),
).to.be.revertedWith("You aren't the owner");

const ownerAfterBalance = await hre.ethers.provider.getBalance(
owner.address,
Expand Down

0 comments on commit a3b786c

Please sign in to comment.