liquid-funding/test/helpers/assertFail.js

13 lines
346 B
JavaScript
Raw Normal View History

2017-07-13 17:12:45 +00:00
const chai = require('chai');
const assert = chai.assert;
2017-06-27 11:08:23 +00:00
module.exports = async function(callback) {
let web3_error_thrown = false;
try {
await callback();
} catch (error) {
2017-10-23 21:25:06 +00:00
if (error.message.includes("invalid opcode")) web3_error_thrown = true;
2017-06-27 11:08:23 +00:00
}
assert.ok(web3_error_thrown, "Transaction should fail");
};