-
Hey Guys, I am wondering if its possible to check one function call for several emitted events, similar to this code here (which I have not managed to get working):
Currently I can only manage to check for one event which limits my ability to check if a function call really does what it should (in my case: 1) emit event in our contract and 2) call another contract that emits an event, too). Also, it seems that when I check for event 2 (the one that is emitted by another contract that my contract calls) it fails all the time....so can I only check for events emitted by the contract I am testing? Thanks a lot for any advice |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
That should work, I've used |
Beta Was this translation helpful? Give feedback.
-
Hi Matt, thanks for your response. Another question I was not able to answer yet is: |
Beta Was this translation helpful? Give feedback.
-
Hey Guys, I have a test case where I am checking for two events to be emitted. The test fails with "Log != expected log" without giving me any details about which parameter or value didnt match, even when run with highest verbose level. when I comment out either of the two event checks, the test passes. So both events seem fine by themselves. Also the call tree suggests that all event parameters match. I dont know where else to look for the error. Do you have any idea what could be going wrong here? Relevant Code: Any idea what could cause this behaviour? And a suggestion:
|
Beta Was this translation helpful? Give feedback.
-
Hey Guys, I just found the issue. |
Beta Was this translation helpful? Give feedback.
Hey Guys,
I just found the issue.
It was the order of the vm.expectEmit() calls.
They have to be in the same order as the events which are being emitted (which makes sense but I didnt think of that).
Maybe makes sense to add a note about that in the docs?