mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix timing-reliant network controller test (#9088)
* fix timing-reliant network controller test * only call initializeProvider where necessary
This commit is contained in:
commit
5c4a8aaf32
@ -18,7 +18,6 @@ describe('NetworkController', function () {
|
|||||||
.reply(200)
|
.reply(200)
|
||||||
|
|
||||||
networkController = new NetworkController()
|
networkController = new NetworkController()
|
||||||
networkController.initializeProvider(networkControllerProviderConfig)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
@ -34,8 +33,9 @@ describe('NetworkController', function () {
|
|||||||
assert.equal(providerProxy.test, true)
|
assert.equal(providerProxy.test, true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('#getNetworkState', function () {
|
describe('#getNetworkState', function () {
|
||||||
it('should return loading when new', function () {
|
it('should return "loading" when new', function () {
|
||||||
const networkState = networkController.getNetworkState()
|
const networkState = networkController.getNetworkState()
|
||||||
assert.equal(networkState, 'loading', 'network is loading')
|
assert.equal(networkState, 'loading', 'network is loading')
|
||||||
})
|
})
|
||||||
@ -51,11 +51,13 @@ describe('NetworkController', function () {
|
|||||||
|
|
||||||
describe('#setProviderType', function () {
|
describe('#setProviderType', function () {
|
||||||
it('should update provider.type', function () {
|
it('should update provider.type', function () {
|
||||||
|
networkController.initializeProvider(networkControllerProviderConfig)
|
||||||
networkController.setProviderType('mainnet')
|
networkController.setProviderType('mainnet')
|
||||||
const type = networkController.getProviderConfig().type
|
const type = networkController.getProviderConfig().type
|
||||||
assert.equal(type, 'mainnet', 'provider type is updated')
|
assert.equal(type, 'mainnet', 'provider type is updated')
|
||||||
})
|
})
|
||||||
it('should set the network to loading', function () {
|
it('should set the network to loading', function () {
|
||||||
|
networkController.initializeProvider(networkControllerProviderConfig)
|
||||||
networkController.setProviderType('mainnet')
|
networkController.setProviderType('mainnet')
|
||||||
const loading = networkController.isNetworkLoading()
|
const loading = networkController.isNetworkLoading()
|
||||||
assert.ok(loading, 'network is loading')
|
assert.ok(loading, 'network is loading')
|
||||||
|
Loading…
Reference in New Issue
Block a user