2016-10-15 19:54:19 +00:00
|
|
|
/*globals describe, it*/
|
2017-03-29 15:37:30 +00:00
|
|
|
let Config = require('../lib/core/config.js');
|
|
|
|
let Plugins = require('../lib/core/plugins.js');
|
|
|
|
let assert = require('assert');
|
2016-10-15 19:54:19 +00:00
|
|
|
|
|
|
|
describe('embark.Config', function() {
|
2017-03-29 15:37:30 +00:00
|
|
|
let config = new Config({
|
2016-10-15 19:54:19 +00:00
|
|
|
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();
|
2017-03-29 15:37:30 +00:00
|
|
|
let expectedConfig = {
|
2017-03-01 04:40:40 +00:00
|
|
|
"enabled": true,
|
2016-10-15 19:54:19 +00:00
|
|
|
"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();
|
2017-03-29 15:37:30 +00:00
|
|
|
let expectedConfig = {
|
2016-10-15 19:54:19 +00:00
|
|
|
"gas": "auto",
|
|
|
|
"contracts": {
|
|
|
|
"SimpleStorage": {
|
|
|
|
"args": [
|
|
|
|
100
|
|
|
|
],
|
|
|
|
"gas": 123456
|
|
|
|
},
|
|
|
|
"Token": {
|
|
|
|
"args": [
|
|
|
|
200
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
assert.deepEqual(config.contractsConfig, expectedConfig);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|