Created
March 20, 2018 00:04
-
-
Save agawish/478be21f57451a9e4798e8c455212905 to your computer and use it in GitHub Desktop.
Helpers - expectRevert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired By: | |
// https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/test/helpers/assertRevert.js | |
const expect = require('chai').expect; | |
module.exports = async (promise) => { | |
try { | |
await promise; | |
assert.fail('Expected revert not received'); | |
} catch (error) { | |
expect(error.message, `Expected "revert", got ${error} instead`).to.contain('revert'); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment