blob: 0665c498e71cec5925840733dd2997a93b1a8286 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
// polyfill fetch
global.fetch = global.fetch || require('isomorphic-fetch')
const assert = require('assert')
const nock = require('nock')
const InfuraController = require('../../app/scripts/controllers/infura')
describe('infura-controller', function () {
var infuraController
beforeEach(function () {
infuraController = new InfuraController()
})
describe('network status queries', function () {
describe('#checkInfuraNetworkStatus', function () {
it('should return an object reflecting the network statuses', function () {
this.timeout(15000)
nock('https://api.infura.io')
.get('/v1/status/metamask')
.reply(200, '{"mainnet": "ok", "ropsten": "degraded", "kovan": "down", "rinkeby": "ok"}')
infuraController.checkInfuraNetworkStatus()
.then(() => {
const networkStatus = infuraController.store.getState().infuraNetworkStatus
assert.equal(Object.keys(networkStatus).length, 4)
assert.equal(networkStatus.mainnet, 'ok')
assert.equal(networkStatus.ropsten, 'degraded')
assert.equal(networkStatus.kovan, 'down')
})
})
})
})
})
|