* signing prefix added
* Minor improvement
* Tests changed
* Successfully tested
* Minor improvements
* Minor improvements
* Revert "Dangling commas are now required. (#1359)"
This reverts commit a6889776f4.
* updates
* fixes #1404
* approve failing test
* suggested changes done
* ISafeERC20 removed
* conflict fixes
* fixes #1205
* minor change
* suggested changes
* reviewed changes
* final update
37 lines
817 B
JavaScript
37 lines
817 B
JavaScript
const { should } = require('./setup');
|
|
|
|
async function shouldFailWithMessage (promise, message) {
|
|
try {
|
|
await promise;
|
|
} catch (error) {
|
|
if (message) {
|
|
error.message.should.include(message, `Wrong failure type, expected '${message}'`);
|
|
}
|
|
return;
|
|
}
|
|
|
|
should.fail('Expected failure not received');
|
|
}
|
|
|
|
async function reverting (promise) {
|
|
await shouldFailWithMessage(promise, 'revert');
|
|
}
|
|
|
|
async function throwing (promise) {
|
|
await shouldFailWithMessage(promise, 'invalid opcode');
|
|
}
|
|
|
|
async function outOfGas (promise) {
|
|
await shouldFailWithMessage(promise, 'out of gas');
|
|
}
|
|
|
|
async function shouldFail (promise) {
|
|
await shouldFailWithMessage(promise);
|
|
}
|
|
|
|
shouldFail.reverting = reverting;
|
|
shouldFail.throwing = throwing;
|
|
shouldFail.outOfGas = outOfGas;
|
|
|
|
module.exports = shouldFail;
|