1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-25 21:00:23 +02:00
metamask-extension/test/unit/actions/config_test.js
Erik Marks 088d4c34f1
Merge pull request from GHSA-c2xw-px2x-pr65
* Remove network config store
* Remove inline networks variable in network controller
* Re-key network controller 'rpcTarget' to 'rpcUrl'
* Require chainId in lookupNetwork, implement eth_chainId
* Require chain ID in network form
* Add alert, migrations, and tests
* Add chainId validation to addToFrequentRpcList
* Update public config state selector to match new network controller
state
* Use network enums in networks-tab.constants
* Ensure chainId in provider config is current
* Update tests
2020-10-06 15:27:02 -02:30

33 lines
859 B
JavaScript

import assert from 'assert'
import freeze from 'deep-freeze-strict'
import reducers from '../../../ui/app/ducks'
import * as actionConstants from '../../../ui/app/store/actionConstants'
describe('config view actions', function () {
const initialState = {
metamask: {
rpcUrl: 'foo',
frequentRpcList: [],
},
appState: {
currentView: {
name: 'accounts',
},
},
}
freeze(initialState)
describe('SET_RPC_TARGET', function () {
it('sets the state.metamask.rpcUrl property of the state to the action.value', function () {
const action = {
type: actionConstants.SET_RPC_TARGET,
value: 'foo',
}
const result = reducers(initialState, action)
assert.equal(result.metamask.provider.type, 'rpc')
assert.equal(result.metamask.provider.rpcUrl, 'foo')
})
})
})