You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.8 KiB
63 lines
1.8 KiB
8 years ago
|
const assert = require('assert')
|
||
8 years ago
|
const sinon = require('sinon')
|
||
7 years ago
|
const InfuraController = require('../../../../app/scripts/controllers/infura')
|
||
8 years ago
|
|
||
|
describe('infura-controller', function () {
|
||
8 years ago
|
let infuraController, sandbox, networkStatus
|
||
|
const response = {'mainnet': 'degraded', 'ropsten': 'ok', 'kovan': 'ok', 'rinkeby': 'down'}
|
||
8 years ago
|
|
||
|
before(async function () {
|
||
|
infuraController = new InfuraController()
|
||
7 years ago
|
sandbox = sinon.createSandbox()
|
||
8 years ago
|
sinon.stub(infuraController, 'checkInfuraNetworkStatus').resolves(response)
|
||
|
networkStatus = await infuraController.checkInfuraNetworkStatus()
|
||
|
})
|
||
|
|
||
|
after(function () {
|
||
|
sandbox.restore()
|
||
8 years ago
|
})
|
||
|
|
||
|
describe('Network status queries', function () {
|
||
|
|
||
|
describe('Mainnet', function () {
|
||
|
it('should have Mainnet', function () {
|
||
8 years ago
|
assert.equal(Object.keys(networkStatus)[0], 'mainnet')
|
||
8 years ago
|
})
|
||
|
|
||
|
it('should have a value for Mainnet status', function () {
|
||
8 years ago
|
assert.equal(networkStatus.mainnet, 'degraded')
|
||
8 years ago
|
})
|
||
|
})
|
||
|
|
||
|
describe('Ropsten', function () {
|
||
|
it('should have Ropsten', function () {
|
||
8 years ago
|
assert.equal(Object.keys(networkStatus)[1], 'ropsten')
|
||
8 years ago
|
})
|
||
|
|
||
|
it('should have a value for Ropsten status', function () {
|
||
8 years ago
|
assert.equal(networkStatus.ropsten, 'ok')
|
||
8 years ago
|
})
|
||
|
})
|
||
|
|
||
|
describe('Kovan', function () {
|
||
|
it('should have Kovan', function () {
|
||
8 years ago
|
assert.equal(Object.keys(networkStatus)[2], 'kovan')
|
||
8 years ago
|
})
|
||
|
|
||
|
it('should have a value for Kovan status', function () {
|
||
8 years ago
|
assert.equal(networkStatus.kovan, 'ok')
|
||
8 years ago
|
})
|
||
|
})
|
||
|
|
||
|
describe('Rinkeby', function () {
|
||
|
it('should have Rinkeby', function () {
|
||
8 years ago
|
assert.equal(Object.keys(networkStatus)[3], 'rinkeby')
|
||
8 years ago
|
})
|
||
|
|
||
|
it('should have a value for Rinkeby status', function () {
|
||
8 years ago
|
assert.equal(networkStatus.rinkeby, 'down')
|
||
8 years ago
|
})
|
||
|
})
|
||
|
})
|
||
|
})
|