I am using the openzeppelin-test-helpers – more specifically, I am interested in the time.increase
function – in my test file in an Embark project. If I do the regular
const { time } = require('openzeppelin-test-helpers');
the use of time
will fail with
1) SimpleStorage
get storage value after timewarp:
TypeError: Cannot read property 'send' of null
at Object.increase (node_modules/openzeppelin-test-helpers/src/time.js:30:40)
at Context.<anonymous> (test/simple_storage_spec.js:41:16)
I eventually got it working by calling the configure
method in the callback of the Embark config
function.
let helpers;
config({
contracts: {
"SimpleStorage": {
args: [100]
}
}
}, (_err, web3_accounts) => {
require('openzeppelin-test-helpers/configure')({ web3: web3 });
helpers = require('openzeppelin-test-helpers');
});
contract("SimpleStorage", function () { ... }
Question is: is this the recommended way to go? Has anyone encountered this before? It feels… ugly.