aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/actions
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/actions')
-rw-r--r--test/unit/actions/config_test.js32
1 files changed, 29 insertions, 3 deletions
diff --git a/test/unit/actions/config_test.js b/test/unit/actions/config_test.js
index f851e4102..eca2f7c8f 100644
--- a/test/unit/actions/config_test.js
+++ b/test/unit/actions/config_test.js
@@ -11,6 +11,7 @@ describe ('config view actions', function() {
var initialState = {
metamask: {
rpcTarget: 'foo',
+ frequentRpcList: []
},
appState: {
currentView: {
@@ -32,13 +33,38 @@ describe ('config view actions', function() {
it('sets the state.metamask.rpcTarget property of the state to the action.value', function() {
const action = {
type: actions.SET_RPC_TARGET,
- value: 'bar',
+ value: 'foo',
+ }
+
+ const secondAction = {
+ type: actions.SET_RPC_LIST,
+ value: ['foo'],
}
var result = reducers(initialState, action)
+ result = reducers(result, secondAction)
assert.equal(result.metamask.provider.type, 'rpc')
- assert.equal(result.metamask.provider.rpcTarget, action.value)
+ assert.equal(result.metamask.provider.rpcTarget, 'foo')
+ assert.equal(result.metamask.frequentRpcList[0], 'foo')
+ })
+
+ it('should handle multiple requests to change the rpc gracefully', function() {
+ const action = {
+ type: actions.SET_RPC_TARGET,
+ value: 'foo',
+ }
+
+ const secondAction = {
+ type: actions.SET_RPC_LIST,
+ value: ['foo'],
+ }
+
+ var result = reducers(initialState, action)
+ var secondResult = reducers(result, secondAction)
+ var thirdResult = reducers(secondResult, action)
+ var fourthResult = reducers(thirdResult, secondAction)
+ assert.equal(fourthResult.metamask.frequentRpcList.length, 1)
})
})
-})
+})