fix compiler tests

This commit is contained in:
Iuri Matias 2018-05-20 06:46:12 -04:00 committed by Jonathan Rainville
parent 16eaacbd54
commit 0ec4698e6b
2 changed files with 21 additions and 2 deletions

View File

@ -42,6 +42,10 @@ class DeployManager {
} }
return callback(null, contractsManager); return callback(null, contractsManager);
}, },
// TODO: remove this
// instead it can make a request to check if it's connected to a node
function checkWeb3IsConnected(contractsManager, callback) { function checkWeb3IsConnected(contractsManager, callback) {
if (!self.web3) { if (!self.web3) {
return callback(Error("no web3 instance found")); return callback(Error("no web3 instance found"));
@ -74,6 +78,7 @@ class DeployManager {
callback(null, contractsManager, web3); callback(null, contractsManager, web3);
}); });
}, },
function deployAllContracts(contractsManager, web3, callback) { function deployAllContracts(contractsManager, web3, callback) {
let deploy = new Deploy({ let deploy = new Deploy({
blockchain: self.blockchain, blockchain: self.blockchain,
@ -97,6 +102,7 @@ class DeployManager {
}); });
}, },
function runAfterDeployCommands(contractsManager, web3, callback) { function runAfterDeployCommands(contractsManager, web3, callback) {
// TODO: should instead emit a afterDeploy event and/or run a afterDeploy plugin
let afterDeployCmds = self.config.contractsConfig.afterDeploy || []; let afterDeployCmds = self.config.contractsConfig.afterDeploy || [];
let withErrors = false; let withErrors = false;

View File

@ -1,5 +1,6 @@
/*globals describe, it*/ /*globals describe, it*/
let ContractsManager = require('../lib/contracts/contracts.js'); let ContractsManager = require('../lib/contracts/contracts.js');
let Compiler = require('../lib/contracts/compiler.js');
let Logger = require('../lib/core/logger.js'); let Logger = require('../lib/core/logger.js');
let File = require('../lib/core/file.js'); let File = require('../lib/core/file.js');
let TestLogger = require('../lib/tests/test_logger.js'); let TestLogger = require('../lib/tests/test_logger.js');
@ -29,6 +30,12 @@ describe('embark.Contracts', function() {
}); });
plugins.loadInternalPlugin('solidity', {solcVersion: '0.4.17', contractDirectories: ['app/contracts/']}); plugins.loadInternalPlugin('solidity', {solcVersion: '0.4.17', contractDirectories: ['app/contracts/']});
let compiler = new Compiler({plugins: plugins, logger: plugins.logger});
let events = new Events();
events.setCommandHandler("compiler:contracts", function(contractFiles, cb) {
compiler.compile_contracts(contractFiles, cb);
});
let contractsManager = new ContractsManager({ let contractsManager = new ContractsManager({
plugins: plugins, plugins: plugins,
contractFiles: [ contractFiles: [
@ -65,7 +72,7 @@ describe('embark.Contracts', function() {
} }
}, },
logger: new Logger({}), logger: new Logger({}),
events: new Events() events: events
}); });
describe('#build', function() { describe('#build', function() {
@ -112,6 +119,12 @@ describe('embark.Contracts', function() {
}); });
plugins.loadInternalPlugin('solidity', {solcVersion: '0.4.17', contractDirectories: ['app/contracts/']}); plugins.loadInternalPlugin('solidity', {solcVersion: '0.4.17', contractDirectories: ['app/contracts/']});
let compiler = new Compiler({plugins: plugins, logger: plugins.logger});
let events = new Events();
events.setCommandHandler("compiler:contracts", function(contractFiles, cb) {
compiler.compile_contracts(contractFiles, cb);
});
let contractsManager = new ContractsManager({ let contractsManager = new ContractsManager({
plugins: plugins, plugins: plugins,
contractFiles: [ contractFiles: [
@ -158,7 +171,7 @@ describe('embark.Contracts', function() {
} }
}, },
logger: new Logger({}), logger: new Logger({}),
events: new Events() events: events
}); });
describe('#build', function() { describe('#build', function() {