test: add unit test for node getNetworkName

This commit is contained in:
Braydon Fuller 2016-05-23 13:46:03 -04:00
parent bce64d86e3
commit 584dd2cb98
1 changed files with 25 additions and 3 deletions

View File

@ -12,9 +12,7 @@ var log = index.log;
describe('Bitcore Node', function() {
var baseConfig = {
datadir: 'testdir'
};
var baseConfig = {};
var Node;
@ -317,6 +315,30 @@ describe('Bitcore Node', function() {
});
});
describe('#getNetworkName', function() {
afterEach(function() {
bitcore.Networks.disableRegtest();
});
it('it will return the network name for livenet', function() {
var node = new Node(baseConfig);
node.getNetworkName().should.equal('livenet');
});
it('it will return the network name for testnet', function() {
var baseConfig = {
network: 'testnet'
};
var node = new Node(baseConfig);
node.getNetworkName().should.equal('testnet');
});
it('it will return the network for regtest', function() {
var baseConfig = {
network: 'regtest'
};
var node = new Node(baseConfig);
node.getNetworkName().should.equal('regtest');
});
});
describe('#stop', function() {
var sandbox = sinon.sandbox.create();
beforeEach(function() {