Open jan10101 opened 2 years ago
Hi Jan 👋
emit
needs two argument.
From hardhat-chai-matchers
source code:
emit(contract: any, eventName: string): EmitAssertion;
So, try first to pass it all, as follow:
it("emits an event after listing an item", async () => {
await expect(nftMarketplace.listItem(basicNft.address, TOKEN_ID, PRICE)).to.emit(
nftMarketplace,
"ItemListed"
)
})
Cheers
hi, I got the same error help!!!!
hi, I got the same error help!!!!
Did you already import @nomicfoundation/hardhat-chai-matchers in hardhat config?
I noticed an issue in the unit tests. The following syntax is used:
This seems to be incorrect. I can type anything for the event name and the test will pass. E.g.:
Reading the chai docs it seems the "await" needs to be in front of the "expect" like this:
But doing so fails with the following error message:
Does anyone know why this is failing and how we could get a working code for listening for events?