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 that is also gives the same error
I am trying to to revert it when the error occurred in the smart contract
New contributor
Brijesh Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.