Relative Content

Tag Archive for ethereumblockchainethers.jshardhatether

revertWith(“Not Enough Tokens”) Invalid Chai property: revertedWith

it(“Should fail if sender does not have enough tokens” , async function(){ const initialOwnerBalance = await hardhatToken.balanceOf(owner.address); // initially – 0 tokens addr1 await expect(hardhatToken.connect(addr1).transfer(owner.address , 1)).to.be.revertedWith(“Not enough tokens”); expect(await hardhatToken.balanceOf(owner.address).toString()).to.equal(initialOwnerBalance.toString()); }) it gives this Error Should fail if sender does not have enough tokens: Error: Invalid Chai property: revertedWith i also try rejectWith but […]