assertRevert.js 319 B

12345678910111213
  1. module.exports = {
  2. assertRevert: async (promise) => {
  3. try {
  4. await promise;
  5. } catch (error) {
  6. const revertFound = error.message.search('revert') >= 0;
  7. assert(revertFound, `Expected "revert", got ${error} instead`);
  8. return;
  9. }
  10. assert.fail('Expected revert not received');
  11. },
  12. };