aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/network-contoller-test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/network-contoller-test.js')
-rw-r--r--test/unit/network-contoller-test.js42
1 files changed, 41 insertions, 1 deletions
diff --git a/test/unit/network-contoller-test.js b/test/unit/network-contoller-test.js
index dd0b52365..2b905718b 100644
--- a/test/unit/network-contoller-test.js
+++ b/test/unit/network-contoller-test.js
@@ -1,6 +1,10 @@
const assert = require('assert')
const nock = require('nock')
const NetworkController = require('../../app/scripts/controllers/network')
+const {
+ getNetworkDisplayName,
+ getNetworkEndpoints,
+} = require('../../app/scripts/controllers/network/util')
const { createTestProviderTools } = require('../stub/provider')
const providerResultStub = {}
@@ -79,4 +83,40 @@ describe('# Network Controller', function () {
})
})
})
-}) \ No newline at end of file
+})
+
+describe('# Network utils', () => {
+ it('getNetworkDisplayName should return the correct network name', () => {
+ const tests = [
+ {
+ input: 3,
+ expected: 'Ropsten',
+ }, {
+ input: 4,
+ expected: 'Rinkeby',
+ }, {
+ input: 42,
+ expected: 'Kovan',
+ }, {
+ input: 'ropsten',
+ expected: 'Ropsten',
+ }, {
+ input: 'rinkeby',
+ expected: 'Rinkeby',
+ }, {
+ input: 'kovan',
+ expected: 'Kovan',
+ }, {
+ input: 'mainnet',
+ expected: 'Main Ethereum Network',
+ },
+ ]
+
+ tests.forEach(({ input, expected }) => assert.equal(getNetworkDisplayName(input), expected))
+ })
+
+ it('getNetworkEndpoints should return the correct endpoints', () => {
+ assert.equal(getNetworkEndpoints('networkBeta').ropsten, 'https://ropsten.infura.io/metamask2')
+ assert.equal(getNetworkEndpoints('network').rinkeby, 'https://rinkeby.infura.io/metamask')
+ })
+})