From 0ec4698e6b818b474cb30c8ed6b78eb5cae20445 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sun, 20 May 2018 06:46:12 -0400 Subject: [PATCH] fix compiler tests --- lib/contracts/deploy_manager.js | 6 ++++++ test/contracts.js | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/contracts/deploy_manager.js b/lib/contracts/deploy_manager.js index 3418fb26..4dde6a92 100644 --- a/lib/contracts/deploy_manager.js +++ b/lib/contracts/deploy_manager.js @@ -42,6 +42,10 @@ class DeployManager { } 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) { if (!self.web3) { return callback(Error("no web3 instance found")); @@ -74,6 +78,7 @@ class DeployManager { callback(null, contractsManager, web3); }); }, + function deployAllContracts(contractsManager, web3, callback) { let deploy = new Deploy({ blockchain: self.blockchain, @@ -97,6 +102,7 @@ class DeployManager { }); }, 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 withErrors = false; diff --git a/test/contracts.js b/test/contracts.js index 3090f416..bb695dc7 100644 --- a/test/contracts.js +++ b/test/contracts.js @@ -1,5 +1,6 @@ /*globals describe, it*/ let ContractsManager = require('../lib/contracts/contracts.js'); +let Compiler = require('../lib/contracts/compiler.js'); let Logger = require('../lib/core/logger.js'); let File = require('../lib/core/file.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/']}); + 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({ plugins: plugins, contractFiles: [ @@ -65,7 +72,7 @@ describe('embark.Contracts', function() { } }, logger: new Logger({}), - events: new Events() + events: events }); describe('#build', function() { @@ -112,6 +119,12 @@ describe('embark.Contracts', function() { }); 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({ plugins: plugins, contractFiles: [ @@ -158,7 +171,7 @@ describe('embark.Contracts', function() { } }, logger: new Logger({}), - events: new Events() + events: events }); describe('#build', function() {