I was using "truffle test" for testing with JS. gives this error. here is the code of that part.
it('transfer success', function(){
return Eve.deployed().then(function(instance){
tokenInstance = instance;
// testing "require" first by sending larger than the senders balance
return tokenInstance.transfer.call(accounts[1], 9999999999999);
}).then(assert.fail).catch(function(error){
assert(error.message.indexOf('revert' >= 0, 'error message must contain revert'));
return tokenInstance.transfer.call(accounts[1], 250000, { from: accounts[0] });
}).then(function(success){
assert.equal(success, true,'returns true');
return tokenInstance.transfer(accounts[1], 250000, { from: accounts[0] });
}).then(function(receipt){
assert.equal(receipt.logs[0].length,1, 'transfer one event');
assert.equal(receipt.logs[0].event, 'Transfer', 'the "Transfer" event');
assert.equal(receipt.logs[0].args._from, accounts[0], 'logs the account thr tokens are transferred from');
assert.equal(receipt.logs[0].args._to, accounts[1], 'logs the account thr token are transferred to');
assert.equal(receipt.logs[0].args._value,250000, 'logs the transfer amount');
return tokenInstance.balanceOf(accounts[1]);
}).then(function(balance){
assert.equal(balance.toNumber(), 250000,'adds amount to recevers account');
return tokenInstance.balanceOf(accounts[0]);
}).then(function(balance){
assert.equal(balance.toNumber(), (10000000 - 250000),'remaining balance of senders account');
});
});
upon "truffle test" gives the following error.
ReferenceError: accounts is not defined
background : creating erc20 token as per standards. the first 2 tests run successfully How can i troubleshoot this?
contract("MyContract", function(accounts) { ...});