From 86e1b115cc8c0dc720a1f25159f0235f413d7cee Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 14 Jun 2018 09:53:46 -0400 Subject: [PATCH] update tests --- test/contracts.js | 152 ++++++++++++++++++++++++++-------------------- 1 file changed, 86 insertions(+), 66 deletions(-) diff --git a/test/contracts.js b/test/contracts.js index 9662fa8b..0eb708d9 100644 --- a/test/contracts.js +++ b/test/contracts.js @@ -43,6 +43,43 @@ describe('embark.Contracts', function() { compiler.compile_contracts(contractFiles, cb); }); + events.setCommandHandler("config:contractsConfig", function(cb) { + cb(contractsConfig); + }); + + events.setCommandHandler("config:contractsFiles", (cb) => { + cb([]); + }); + + let contractsConfig = { + "versions": { + "web3.js": "1.0.0-beta", + "solc": "0.4.17" + }, + "deployment": { + "host": "localhost", + "port": 8545, + "type": "rpc" + }, + "dappConnection": [ + "$WEB3", + "localhost:8545" + ], + "gas": "auto", + "contracts": { + "Token": { + "args": [ + 100 + ] + }, + "SimpleStorage": { + "args": [ + 200 + ] + } + } + }; + let contractsManager = new ContractsManager({ plugins: plugins, contractFiles: [ @@ -50,34 +87,7 @@ describe('embark.Contracts', function() { readFile('test/contracts/token.sol') ], contractDirectories: ['app/contracts'], - contractsConfig: { - "versions": { - "web3.js": "1.0.0-beta", - "solc": "0.4.17" - }, - "deployment": { - "host": "localhost", - "port": 8545, - "type": "rpc" - }, - "dappConnection": [ - "$WEB3", - "localhost:8545" - ], - "gas": "auto", - "contracts": { - "Token": { - "args": [ - 100 - ] - }, - "SimpleStorage": { - "args": [ - 200 - ] - } - } - }, + contractsConfig: contractsConfig, logger: new Logger({}), events: events }); @@ -138,6 +148,53 @@ describe('embark.Contracts', function() { compiler.compile_contracts(contractFiles, cb); }); + events.setCommandHandler("config:contractsConfig", function(cb) { + cb(contractsConfig); + }); + + events.setCommandHandler("config:contractsFiles", (cb) => { + cb([]); + }); + + let contractsConfig = { + "versions": { + "web3.js": "1.0.0-beta", + "solc": "0.4.17" + }, + "deployment": { + "host": "localhost", + "port": 8545, + "type": "rpc" + }, + "dappConnection": [ + "$WEB3", + "localhost:8545" + ], + "gas": "auto", + "contracts": { + "TokenStorage": { + "args": [ + 100, + "$SimpleStorage" + ] + }, + "MySimpleStorage": { + "instanceOf": "SimpleStorage", + "args": [ + 300 + ] + }, + "SimpleStorage": { + "args": [ + 200 + ] + }, + "AnotherSimpleStorage": { + "instanceOf": "SimpleStorage" + } + } + } + let contractsManager = new ContractsManager({ plugins: plugins, contractFiles: [ @@ -145,44 +202,7 @@ describe('embark.Contracts', function() { readFile('test/contracts/token_storage.sol') ], contractDirectories: ['app/contracts'], - contractsConfig: { - "versions": { - "web3.js": "1.0.0-beta", - "solc": "0.4.17" - }, - "deployment": { - "host": "localhost", - "port": 8545, - "type": "rpc" - }, - "dappConnection": [ - "$WEB3", - "localhost:8545" - ], - "gas": "auto", - "contracts": { - "TokenStorage": { - "args": [ - 100, - "$SimpleStorage" - ] - }, - "MySimpleStorage": { - "instanceOf": "SimpleStorage", - "args": [ - 300 - ] - }, - "SimpleStorage": { - "args": [ - 200 - ] - }, - "AnotherSimpleStorage": { - "instanceOf": "SimpleStorage" - } - } - }, + contractsConfig: contractsConfig, logger: new Logger({}), events: events });