aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-05-03 09:07:29 +0800
committerkumavis <aaron@kumavis.me>2018-05-03 09:07:29 +0800
commitd2aa36f866ae25b2facb90583d552097a80d42b3 (patch)
treed6e2f2ef4a549a914071906e3c66d4554b29fc94
parentfec4c50657c0be5bdae9dd211ef4b1a6ebb1be43 (diff)
downloadtangerine-wallet-browser-d2aa36f866ae25b2facb90583d552097a80d42b3.tar
tangerine-wallet-browser-d2aa36f866ae25b2facb90583d552097a80d42b3.tar.gz
tangerine-wallet-browser-d2aa36f866ae25b2facb90583d552097a80d42b3.tar.bz2
tangerine-wallet-browser-d2aa36f866ae25b2facb90583d552097a80d42b3.tar.lz
tangerine-wallet-browser-d2aa36f866ae25b2facb90583d552097a80d42b3.tar.xz
tangerine-wallet-browser-d2aa36f866ae25b2facb90583d552097a80d42b3.tar.zst
tangerine-wallet-browser-d2aa36f866ae25b2facb90583d552097a80d42b3.zip
test - network controller - remove tests for deprecated APIs + update tests
-rw-r--r--test/unit/network-contoller-test.js30
1 files changed, 5 insertions, 25 deletions
diff --git a/test/unit/network-contoller-test.js b/test/unit/network-contoller-test.js
index 2b905718b..2d590a3f6 100644
--- a/test/unit/network-contoller-test.js
+++ b/test/unit/network-contoller-test.js
@@ -3,17 +3,15 @@ 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 = {}
-const provider = createTestProviderTools({ scaffold: providerResultStub }).provider
describe('# Network Controller', function () {
let networkController
const noop = () => {}
- const networkControllerProviderInit = {
+ const networkControllerProviderConfig = {
getAccounts: noop,
}
@@ -24,11 +22,9 @@ describe('# Network Controller', function () {
.post('/metamask')
.reply(200)
- networkController = new NetworkController({
- provider,
- })
+ networkController = new NetworkController()
- networkController.initializeProvider(networkControllerProviderInit, provider)
+ networkController.initializeProvider(networkControllerProviderConfig)
})
afterEach(function () {
@@ -38,7 +34,7 @@ describe('# Network Controller', function () {
describe('network', function () {
describe('#provider', function () {
it('provider should be updatable without reassignment', function () {
- networkController.initializeProvider(networkControllerProviderInit, provider)
+ networkController.initializeProvider(networkControllerProviderConfig)
const proxy = networkController._proxy
proxy.setTarget({ test: true, on: () => {} })
assert.ok(proxy.test)
@@ -59,12 +55,6 @@ describe('# Network Controller', function () {
})
})
- describe('#getRpcAddressForType', function () {
- it('should return the right rpc address', function () {
- const rpcTarget = networkController.getRpcAddressForType('mainnet')
- assert.equal(rpcTarget, 'https://mainnet.infura.io/metamask', 'returns the right rpcAddress')
- })
- })
describe('#setProviderType', function () {
it('should update provider.type', function () {
networkController.setProviderType('mainnet')
@@ -76,16 +66,11 @@ describe('# Network Controller', function () {
const loading = networkController.isNetworkLoading()
assert.ok(loading, 'network is loading')
})
- it('should set the right rpcTarget', function () {
- networkController.setProviderType('mainnet')
- const rpcTarget = networkController.getProviderConfig().rpcTarget
- assert.equal(rpcTarget, 'https://mainnet.infura.io/metamask', 'returns the right rpcAddress')
- })
})
})
})
-describe('# Network utils', () => {
+describe('Network utils', () => {
it('getNetworkDisplayName should return the correct network name', () => {
const tests = [
{
@@ -114,9 +99,4 @@ describe('# Network utils', () => {
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')
- })
})