For example, testing for a transaction that reverted or an out of gas error etc.
What is the best practice for writing such tests? Specifically, I am using truffle test framework (mocha/chai).
For example, testing for a transaction that reverted or an out of gas error etc.
What is the best practice for writing such tests? Specifically, I am using truffle test framework (mocha/chai).
You can use Waffle's built-in Chai matchers to test for events, reverts, etc. It works with Truffle and Mocha out of the box, and supports any network provider with history support (like Ganache, BuidlerVM). You can find documentation here:
There are also experimental Jest matchers if you're looking to use Jest instead of Mocha and Chai.