2016-10-15 19:54:19 +00:00
|
|
|
/*globals describe, it*/
|
2017-02-19 17:51:32 +00:00
|
|
|
var Config = require('../lib/core/config.js');
|
|
|
|
var Plugins = require('../lib/core/plugins.js');
|
2016-10-15 19:54:19 +00:00
|
|
|
var assert = require('assert');
|
|
|
|
var fs = require('fs');
|
|
|
|
|
|
|
|
describe('embark.Config', function() {
|
|
|
|
var config = new Config({
|
|
|
|
env: 'myenv',
|
|
|
|
configDir: './test/test1/config/'
|
|
|
|
});
|
2017-01-29 06:28:01 +00:00
|
|
|
config.plugins = new Plugins({plugins: {}});
|
2016-10-15 19:54:19 +00:00
|
|
|
|
|
|
|
describe('#loadBlockchainConfigFile', function() {
|
|
|
|
it('should load blockchain config correctly', function() {
|
|
|
|
config.loadBlockchainConfigFile();
|
|
|
|
var expectedConfig = {
|
|
|
|
"networkType": "custom",
|
|
|
|
"genesisBlock": "config/development/genesis.json",
|
|
|
|
"datadir": ".embark/development/datadir",
|
|
|
|
"mineWhenNeeded": true,
|
|
|
|
"nodiscover": true,
|
|
|
|
"rpcHost": "localhost",
|
|
|
|
"rpcPort": 8545,
|
|
|
|
"rpcCorsDomain": "http://localhost:8000",
|
|
|
|
"account": {
|
|
|
|
"password": "config/development/password"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
assert.deepEqual(config.blockchainConfig, expectedConfig);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('#loadContractsConfigFile', function() {
|
|
|
|
it('should load contract config correctly', function() {
|
|
|
|
config.loadContractsConfigFile();
|
|
|
|
var expectedConfig = {
|
|
|
|
"gas": "auto",
|
|
|
|
"contracts": {
|
|
|
|
"SimpleStorage": {
|
|
|
|
"args": [
|
|
|
|
100
|
|
|
|
],
|
|
|
|
"gas": 123456
|
|
|
|
},
|
|
|
|
"Token": {
|
|
|
|
"args": [
|
|
|
|
200
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
assert.deepEqual(config.contractsConfig, expectedConfig);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|