Skip to content

Commit

Permalink
πŸ‘¨πŸΌβ€πŸŒΎ Add docs for to.emit with events in a Library (#769)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzadp committed Jul 29, 2022
1 parent 4e0598e commit 1fe07bb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/source/matchers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ If you are using Waffle version :code:`3.4.4` or lower, you can't chain :code:`e
.to.emit(contract, 'One')
.to.emit(contract, 'Two');
This feature will be available in Waffle version 4.
This feature is available in Waffle version 4.

Testing the argument names in the event:

Expand All @@ -96,6 +96,17 @@ A subset of arguments in an event can be tested by only including the desired ar
This feature will be available in Waffle version 4.

Events declared and emitted in a library:

If your contract is using a Solidity :code:`Library` that declares and emits events and you want to test your contract for emitting those events, you'll have to specifically point to the library. You can use :code:`attach` method on the library object. An example snippet for this case:

.. code-block:: ts
await expect(contract.function())
.to.emit(library.attach(contract.address), 'MyEvent');
where :code:`library` is the ethers object of the Solidity Library in which :code:`MyEvent` is declared.

Called on contract
------------------

Expand Down

0 comments on commit 1fe07bb

Please sign in to comment.