Waffle
Waffle copied to clipboard
Add satisfy method to Chai emit matcher
I'm testing parts my smart contracts using fast-check (a property based testing library similar to quickcheck). In this case I'm interested in checking general properties of my system rather than specific values.
I propose to add an implementation of Chai's satisfy/satisfies to EmitAssertion that checks whether a predicate on the event is satisfied or not.
I can work on the issue and send a PR, I just wanted to hear your feedback before implementing it.
Example
await expect(token.transfer(walletTo.address, 7))
.to.emit(token, 'Transfer')
.satifies((_from, to, value) => to === walletTo && value === 7)
Related issues
- #437 Check against subset of args emitted in events
- #361 Matching any argument in a mock using withArgs()