From 584dd2cb98230991539de2484bf779429ecf5d8c Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Mon, 23 May 2016 13:46:03 -0400 Subject: [PATCH] test: add unit test for node getNetworkName --- test/node.unit.js | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/test/node.unit.js b/test/node.unit.js index 192cb992..94d22c3c 100644 --- a/test/node.unit.js +++ b/test/node.unit.js @@ -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() {