Test/assertRevert: Fix late return bug (#1123)

We now ensure that if an exception is thrown while awaiting the promise,
the exception _has_ to be a revert. We throw 'Expected revert not
received' only afterwards. This solves any problems with confusing the
word 'revert'.

Fix #775
pull/1089/head
Justus Perlwitz 7 years ago committed by Nicolás Venturo
parent 567b773242
commit 2f6c8b05f6
  1. 3
      test/helpers/assertRevert.js

@ -1,11 +1,12 @@
async function assertRevert (promise) {
try {
await promise;
assert.fail('Expected revert not received');
} catch (error) {
const revertFound = error.message.search('revert') >= 0;
assert(revertFound, `Expected "revert", got ${error} instead`);
return;
}
assert.fail('Expected revert not received');
}
module.exports = {

Loading…
Cancel
Save