diff --git a/test/blockchain.js b/test/blockchain.js index f6414d003..bb80269b6 100644 --- a/test/blockchain.js +++ b/test/blockchain.js @@ -10,7 +10,7 @@ describe('embark.blockchain', function() { var blockchain = new Blockchain(blockchainConfig); it('should return correct cmd', function() { - assert.strictEqual(blockchain.generate_basic_command(), "geth --datadir=\"/tmp/embark\" --logfile=\"/tmp/embark.log\" --port 30303 --rpc --rpcport 8101 --rpcaddr localhost --networkid "+blockchainConfig.networkId+" --rpccorsdomain \"*\" --minerthreads \"1\" --mine --genesis=\"config/genesis.json\" --rpcapi \"eth,web3\" --maxpeers 4 --password config/password "); + assert.strictEqual(blockchain.generate_basic_command(), "geth --datadir=\"/tmp/embark\" --logfile=\"/tmp/embark.log\" --port 30303 --rpc --rpcport 8101 --rpcaddr localhost --networkid "+blockchainConfig.networkId+" --rpccorsdomain \"*\" --minerthreads \"1\" --genesis=\"config/genesis.json\" --rpcapi \"eth,web3\" --maxpeers 4 --password config/password "); }); }); diff --git a/test/chain_manager.js b/test/chain_manager.js index e2add352a..331349dc6 100644 --- a/test/chain_manager.js +++ b/test/chain_manager.js @@ -4,6 +4,10 @@ var Blockchain = require('../lib/blockchain.js'); var assert = require('assert'); var fs = require('fs'); +// TODO: replace with ethersim +var web3 = require('web3'); +web3.setProvider(new web3.providers.HttpProvider("http://localhost:8101")); + describe('embark.chain_manager', function() { var chainFile = './test/support/chain_manager.json'; fs.writeFileSync(chainFile, '{}'); @@ -12,7 +16,7 @@ describe('embark.chain_manager', function() { var blockchainConfig = (new Config.Blockchain()).loadConfigFile('test/support/blockchain.yml').config('development'); describe('#init', function() { - chainManager.init('development', blockchainConfig); + chainManager.init('development', blockchainConfig, web3); it('should initialize chain', function() { var chain = chainManager.chainManagerConfig['0xcd9c11da1e46f86ce40a38b6ef84cfdfa6ea92598a27538f0e87da6d7a5c73d5'] diff --git a/test/compiler.js b/test/compiler.js index 9e3761dfb..4abc6f03a 100644 --- a/test/compiler.js +++ b/test/compiler.js @@ -13,7 +13,7 @@ describe('embark.compiler', function() { var compiledFile = compiler.compile(files[0]); - assert.equal(compiledFile.SimpleStorage.code, '606060405260405160208060f78339016040526060805190602001505b806000600050819055505b5060c28060356000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900480632a1afcd914604b57806360fe47b114606a5780636d4ce63c14607b576049565b005b605460045060b9565b6040518082815260200191505060405180910390f35b6079600480359060200150609a565b005b608460045060a8565b6040518082815260200191505060405180910390f35b806000600050819055505b50565b6000600060005054905060b6565b90565b6000600050548156'); + assert.equal(compiledFile.SimpleStorage.code, '60606040526040516020806075833950608060405251600081905550604e8060276000396000f3606060405260e060020a60003504632a1afcd98114602e57806360fe47b11460365780636d4ce63c146040575b005b604460005481565b600435600055602c565b6000545b6060908152602090f3'); assert.equal(JSON.stringify(compiledFile.SimpleStorage.info.abiDefinition), '[{"constant":true,"inputs":[],"name":"storedData","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"retVal","type":"uint256"}],"type":"function"},{"inputs":[{"name":"initialValue","type":"uint256"}],"type":"constructor"}]'); }); diff --git a/test/config.blockchain.js b/test/config.blockchain.js index 5f5cc9ff8..127d00032 100644 --- a/test/config.blockchain.js +++ b/test/config.blockchain.js @@ -65,6 +65,8 @@ describe('embark.config.blockchain', function() { gasLimit: 123, gasPrice: 100, rpcWhitelist: "*", + testnet: false, + bootNodes: [], whisper: false, minerthreads: 1, genesisBlock: 'config/genesis.json', @@ -76,6 +78,7 @@ describe('embark.config.blockchain', function() { port: "30303", console_toggle: false, mine_when_needed: true, + geth_extra_opts: [], account: { init: true, password: 'config/password' @@ -111,6 +114,8 @@ describe('embark.config.blockchain', function() { gasLimit: 500000, gasPrice: 10000000000000, rpcWhitelist: "*", + testnet: false, + bootNodes: [], whisper: false, minerthreads: 1, genesisBlock: undefined, @@ -122,6 +127,7 @@ describe('embark.config.blockchain', function() { port: "30303", console_toggle: false, mine_when_needed: true, + geth_extra_opts: [], account: { init: true, password: 'config/password' diff --git a/test/deploy.js b/test/deploy.js index e5c1fc46f..8e07d32d4 100644 --- a/test/deploy.js +++ b/test/deploy.js @@ -5,6 +5,10 @@ var ChainManager = require('../lib/chain_manager.js'); var assert = require('assert'); var web3 = require('web3'); +// TODO: replace with ethersim +var web3 = require('web3'); +web3.setProvider(new web3.providers.HttpProvider("http://localhost:8101")); + setDeployConfig = function(config) { var _blockchainConfig = (new Config.Blockchain()).loadConfigFile(config.blockchain); var blockchainConfig = _blockchainConfig.config("development"); diff --git a/test/support/chain_manager.json b/test/support/chain_manager.json index 0b027530b..9e26dfeeb 100644 --- a/test/support/chain_manager.json +++ b/test/support/chain_manager.json @@ -1 +1 @@ -{"0xcd9c11da1e46f86ce40a38b6ef84cfdfa6ea92598a27538f0e87da6d7a5c73d5":{"contracts":{"d5d91a8825c5c253dff531ddda2354c4014f5699b7bcbea70207cfdcb37b6c8b":{"name":"Foo","address":"0x123"}}}} \ No newline at end of file +{} \ No newline at end of file diff --git a/test/support/contracts/token.sol b/test/support/contracts/token.sol index fbaa67391..9f67a1515 100644 --- a/test/support/contracts/token.sol +++ b/test/support/contracts/token.sol @@ -4,7 +4,8 @@ contract token { /* Initializes contract with initial supply tokens to the creator of the contract */ function token(uint supply) { - coinBalanceOf[msg.sender] = (supply || 10000); + //coinBalanceOf[msg.sender] = (supply || 10000); + coinBalanceOf[msg.sender] = 10000; } /* Very simple trade function */