Merge pull request #508 from embark-framework/test_fixes

warn if configured account has no funds
This commit is contained in:
Iuri Matias 2018-06-12 12:10:05 -04:00 committed by GitHub
commit 03870953a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 7 deletions

View File

@ -216,13 +216,6 @@ class Test {
self.engine.events.emit(constants.events.contractConfigChanged, self.engine.config.contractsConfig);
next();
},
function deploy(next) {
self.engine.deployManager.gasLimit = 6000000;
self.engine.contractsManager.gasLimit = 6000000;
self.engine.deployManager.fatalErrors = true;
self.engine.deployManager.deployOnlyOnConfig = true;
self.engine.events.request('deploy:contracts', next);
},
function getAccounts(next) {
self.web3.eth.getAccounts(function (err, accounts) {
if (err) {
@ -233,6 +226,23 @@ class Test {
next(null, accounts);
});
},
function getBalance(accounts, next) {
self.web3.eth.getBalance(self.web3.eth.defaultAccount).then((balance) => {
if (parseInt(balance, 10) === 0) {
console.warn("Warning: default account has no funds");
}
next(null, accounts);
}).catch((err) => { next(err); });
},
function deploy(accounts, next) {
self.engine.deployManager.gasLimit = 6000000;
self.engine.contractsManager.gasLimit = 6000000;
self.engine.deployManager.fatalErrors = true;
self.engine.deployManager.deployOnlyOnConfig = true;
self.engine.events.request('deploy:contracts', () => {
next(null, accounts);
});
},
function createContractObject(accounts, next) {
async.each(Object.keys(self.engine.contractsManager.contracts), (contractName, eachCb) => {
const contract = self.engine.contractsManager.contracts[contractName];