Refactor assert revert helper to encapsulate promises (#628)

This commit is contained in:
Facundo Spagnuolo
2017-12-28 00:39:55 -03:00
committed by Federico Bond
parent 4ce0e211c5
commit 323d1fa941
10 changed files with 44 additions and 159 deletions

View File

@ -1,3 +1,9 @@
module.exports = function (error) {
assert.isAbove(error.message.search('revert'), -1, 'Error containing "revert" must be returned');
export default async 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`);
}
};