I am trying to test my constructor events and want to use as per truffle-assertions documentation :
truffle-assertions offers the possibility to create a transaction result object from a contract instance and a transaction hash, which can then be used in the other functions that the library offers.
let contractInstance = await Contract.new(); let result = await truffleAssert.createTransactionResult(contractInstance, contractInstance.transactionHash); truffleAssert.eventEmitted(result, 'TestEvent');
When I run the following line of code but applied to my contract and then check the event it doesn't work anymore (but did fine with the previous version):
let result = await truffleAssert.createTransactionResult(contractInst, contractInst.transactionHash); truffleAssert.eventEmitted(result, 'Started');
Here is the following error that is returned in the Terminal when I run truffle test:
AssertionError: Event of type ContractStarted was not emitted No events emitted in tx 0x8ed0e7489....
I console.log(result) and it does return a transaction hash. I'm not sure what I should do to get it to work and wonder if it might be due to truffle-assertions createTransactionResult not having been updated for the latest version? Or am I missing a line of code that I now need with the newer version?