Hi, I'm trying to test events from my smart contract, but seems that in not able to recognize transaction receipt object in hardhat.
This is my event:
event AccessTokenPurchased (
string channelId,
address indexed buyer
);
And this is my test:
const receiptPurchase = await accessTokenManager.connect(buyer).purchase(channelId, {value: ethers.utils.parseUnits((price + buyerFee).toString(), 'ether')})
expectEvent(receiptPurchase, 'AccessTokenPurchased', {
channelId: channelId,
buyer: buyer.address
});
But I'm getting this error back:
Error: Unknown transaction receipt object
I have already imported all the required library
test.js
const {
expectEvent,
expectRevert
} = require('@openzeppelin/test-helpers')
hardhat.config.js
require("@nomiclabs/hardhat-truffle5");
Can someone explain if is possible to test event with hardhat?
Thanks.