2020-01-09 04:34:58 +01:00
|
|
|
import assert from 'assert'
|
|
|
|
import sinon from 'sinon'
|
|
|
|
import InfuraController from '../../../../app/scripts/controllers/infura'
|
2017-07-14 19:34:03 +02:00
|
|
|
|
|
|
|
describe('infura-controller', function () {
|
2020-02-18 02:31:09 +01:00
|
|
|
let infuraController, networkStatus
|
2019-12-03 21:50:55 +01:00
|
|
|
const response = { 'mainnet': 'degraded', 'ropsten': 'ok', 'kovan': 'ok', 'rinkeby': 'down', 'goerli': 'ok' }
|
2017-07-14 19:34:03 +02:00
|
|
|
|
|
|
|
describe('Network status queries', function () {
|
2020-02-11 17:51:13 +01:00
|
|
|
before(async function () {
|
|
|
|
infuraController = new InfuraController()
|
|
|
|
sinon.stub(infuraController, 'checkInfuraNetworkStatus').resolves(response)
|
|
|
|
networkStatus = await infuraController.checkInfuraNetworkStatus()
|
|
|
|
})
|
|
|
|
|
2017-07-14 19:34:03 +02:00
|
|
|
describe('Mainnet', function () {
|
|
|
|
it('should have Mainnet', function () {
|
2017-07-14 22:06:42 +02:00
|
|
|
assert.equal(Object.keys(networkStatus)[0], 'mainnet')
|
2017-07-14 19:34:03 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should have a value for Mainnet status', function () {
|
2017-07-14 22:06:42 +02:00
|
|
|
assert.equal(networkStatus.mainnet, 'degraded')
|
2017-07-14 19:34:03 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('Ropsten', function () {
|
|
|
|
it('should have Ropsten', function () {
|
2017-07-14 22:06:42 +02:00
|
|
|
assert.equal(Object.keys(networkStatus)[1], 'ropsten')
|
2017-07-14 19:34:03 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should have a value for Ropsten status', function () {
|
2017-07-14 22:06:42 +02:00
|
|
|
assert.equal(networkStatus.ropsten, 'ok')
|
2017-07-14 19:34:03 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('Kovan', function () {
|
|
|
|
it('should have Kovan', function () {
|
2017-07-14 22:06:42 +02:00
|
|
|
assert.equal(Object.keys(networkStatus)[2], 'kovan')
|
2017-07-14 19:34:03 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should have a value for Kovan status', function () {
|
2017-07-14 22:06:42 +02:00
|
|
|
assert.equal(networkStatus.kovan, 'ok')
|
2017-07-14 19:34:03 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('Rinkeby', function () {
|
|
|
|
it('should have Rinkeby', function () {
|
2017-07-14 22:06:42 +02:00
|
|
|
assert.equal(Object.keys(networkStatus)[3], 'rinkeby')
|
2017-07-14 19:34:03 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should have a value for Rinkeby status', function () {
|
2017-07-14 22:06:42 +02:00
|
|
|
assert.equal(networkStatus.rinkeby, 'down')
|
2017-07-14 19:34:03 +02:00
|
|
|
})
|
|
|
|
})
|
2019-04-17 19:34:49 +02:00
|
|
|
|
|
|
|
describe('Goerli', function () {
|
|
|
|
it('should have Goerli', function () {
|
|
|
|
assert.equal(Object.keys(networkStatus)[4], 'goerli')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should have a value for Goerli status', function () {
|
|
|
|
assert.equal(networkStatus.goerli, 'ok')
|
|
|
|
})
|
|
|
|
})
|
2017-07-14 19:34:03 +02:00
|
|
|
})
|
|
|
|
})
|