i have installed web3 latest version 1.0.0-beta.36. i am using helper libraries which i used from openzeppelin when i am running the test cases using truffle test it shows error as
TypeError: web3.toWei is not a function
it's not just web3.toWei also i am also not able to use bignumber .i don't know why i am not able to use helpers from openzeppelin
this is the file with the name of ether.js in helper folder
function ether (n) {
return new web3.BigNumber(web3.toWei(n, 'ether'));
}
module.exports = {
ether,
};
and for big number the code which shows error is
require('chai')
.use(require('chai-bignumber')(BigNumber))
.should();
const RefundableCrowdsale = artifacts.require('RefundableCrowdsaleImpl');
const SimpleToken = artifacts.require('SimpleToken');
contract('RefundableCrowdsale', function ([_, wallet, investor, purchaser, anyone]) {
const rate = new BigNumber(1);
const goal = ether(48);
const lessThanGoal = ether(45);
const tokenSupply = new BigNumber('1e22');
i have installed chai-bignumber and web3
Best Answer
there is some error in the beta version of truffle 5.0.0-beta.0 so i changed the version to truffle 4.1.14. now all the test cases are running properly.