In the context of testing using hardhat...

**The scenario:** My `token` is transfering from `owner` to `receiverContract`. I want to check that receiverContract emitted a `Received` event.

The transaction looks like this and is initiated by the owner.

```js
const tx = await token.transferFrom(
  owner.address, // <- From this wallet
  receiverContract.address, // <- To this contract
  tokenId,
  {
    from: owner.address,
  }
);

```

How can I check if receiverContract emitted a "Received" event?
Alternatively, if someone can solve this problem with `@openzeppelin/test-helpers` `expectEvent.inTransaction()` that works too.

Edit: The receiver contract code emits an event when it receives something. So we can assume it emits. I just need to write a test for it. I'm not interested in testing for the `Transfer` event on the token itself.
['https://ethereum.stackexchange.com/questions/127322', 'https://ethereum.stackexchange.com', 'https://ethereum.stackexchange.com/users/68369/']
I figured out how to do it.

Each contract can be viewed via `console.log(receiverContract)`... so I eventually navigated to the event object inside the contract. Here is a snippet of the contract when logged...

```js
{
  interface: Interface {
    fragments: [ [ConstructorFragment], [EventFragment], [FunctionFragment] ],
    _abiCoder: AbiCoder { coerceFunc: null },
    functions: {
      'onERC721Received(address,address,uint256,bytes)': [FunctionFragment]
    },
    errors: {},
    events: { // <- This is what we're looking for
      'Received(address,address,uint256,bytes,uint256)': [EventFragment {
    name: 'Received',
    anonymous: false,
    inputs: [ [ParamType], [ParamType], [ParamType], [ParamType], [ParamType] ],
    type: 'event',
    _isFragment: true
  }],
  // ...
}

```

Running `console.log(receiverContract.interface.events)` gives you this nested object

```js
  'Received(address,address,uint256,bytes,uint256)',
  EventFragment {
    name: 'Received', // <- This is the event name
    anonymous: false,
    inputs: [ [ParamType], [ParamType], [ParamType], [ParamType], [ParamType] ],
    type: 'event',
    _isFragment: true
  }

```

So in order to look for and test that the event emitted, this works

```js
expect(
  Object.entries(receiverContract.interface.events).some(
    ([k, v]: any) => v.name === "Received"
  )
).to.be.equal(true);

```
Since there's no interaction with the receiving contract, it will not emit anything.

Transaction is sent to the token, which emits `Transfer` event once it changes records of its ledger.

You can watch the token for `Transfer` event, or read the transaction receipt, decode the log and check for that event.