Skip to content

Instantly share code, notes, and snippets.

@agawish
Created March 20, 2018 00:04
Show Gist options
  • Save agawish/478be21f57451a9e4798e8c455212905 to your computer and use it in GitHub Desktop.
Save agawish/478be21f57451a9e4798e8c455212905 to your computer and use it in GitHub Desktop.
Helpers - expectRevert
// 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