How to test events, that was sent by inner transaction / delegate call?

by delete   Last Updated June 12, 2019 20:28 PM

Usually, using truffle I can check for events like this:

    let { logs } = await myContract.doSomethingImportant( xxx );

    // 1500 tokens are expected to get
    expectEvent.inLogs(logs, 'myImportantEvent', {
      arg1: 111,
      arg2: 'and so on'
    });

However, logs contains only these events that was fired directly inside of the contract function withdrawVestedTokensByTimestamp:

function doSomethingImportant(uint256 x) public returns(uint256) {
    // ... do something else here ...

    emit myImportantEvent(x, amount);

    return amount;
}

However, if in this function a token transfer will happen or another function is called, which would fire events itself, they don't appear in the logs.

Running tests with truffle test --show-events will list all these ones, but how can I catch them inside truffle test?



Related Questions


Updated November 12, 2018 10:28 AM

Updated April 04, 2019 06:28 AM

Updated August 15, 2018 00:28 AM

Updated May 24, 2018 03:28 AM