aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/unit/network-contoller-test.js40
1 files changed, 16 insertions, 24 deletions
diff --git a/test/unit/network-contoller-test.js b/test/unit/network-contoller-test.js
index fe3b9e66a..cd8c345c5 100644
--- a/test/unit/network-contoller-test.js
+++ b/test/unit/network-contoller-test.js
@@ -2,28 +2,37 @@ const assert = require('assert')
const nock = require('nock')
const NetworkController = require('../../app/scripts/controllers/network')
+const { createTestProviderTools } = require('../stub/provider')
+const providerResultStub = {}
+const provider = createTestProviderTools({ scaffold: providerResultStub }).provider
+
describe('# Network Controller', function () {
let networkController
+ const noop = () => {}
const networkControllerProviderInit = {
getAccounts: () => {},
}
beforeEach(function () {
+
nock('https://api.infura.io')
.get('/*/')
- .reply(200, {})
+ .reply(200)
+
+ nock('https://rinkeby.infura.io')
+ .post('/metamask')
+ .reply(200)
+
networkController = new NetworkController({
- provider: {
- type: 'rinkeby',
- },
+ provider,
})
- networkController.initializeProvider(networkControllerProviderInit, dummyProviderConstructor)
+ networkController.initializeProvider(networkControllerProviderInit, provider)
})
describe('network', function () {
describe('#provider', function () {
it('provider should be updatable without reassignment', function () {
- networkController.initializeProvider(networkControllerProviderInit, dummyProviderConstructor)
+ networkController.initializeProvider(networkControllerProviderInit, provider)
const proxy = networkController._proxy
proxy.setTarget({ test: true, on: () => {} })
assert.ok(proxy.test)
@@ -68,21 +77,4 @@ describe('# Network Controller', function () {
})
})
})
-})
-
-function dummyProviderConstructor() {
- return {
- // provider
- sendAsync: noop,
- // block tracker
- _blockTracker: {},
- start: noop,
- stop: noop,
- on: noop,
- addListener: noop,
- once: noop,
- removeAllListeners: noop,
- }
-}
-
-function noop() {} \ No newline at end of file
+}) \ No newline at end of file