aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2017-02-24 05:56:58 +0800
committerKevin Serrano <kevgagser@gmail.com>2017-02-24 05:56:58 +0800
commit62854398f1d3c72a82ae9d4feb03d9a1a947534e (patch)
tree879c6ded10ca1f11bdb7057282ffbc61c01b36e4 /test
parent3be6ee5f6cc5e7b79a8eeea182f91a15eb9ed989 (diff)
downloadtangerine-wallet-browser-62854398f1d3c72a82ae9d4feb03d9a1a947534e.tar
tangerine-wallet-browser-62854398f1d3c72a82ae9d4feb03d9a1a947534e.tar.gz
tangerine-wallet-browser-62854398f1d3c72a82ae9d4feb03d9a1a947534e.tar.bz2
tangerine-wallet-browser-62854398f1d3c72a82ae9d4feb03d9a1a947534e.tar.lz
tangerine-wallet-browser-62854398f1d3c72a82ae9d4feb03d9a1a947534e.tar.xz
tangerine-wallet-browser-62854398f1d3c72a82ae9d4feb03d9a1a947534e.tar.zst
tangerine-wallet-browser-62854398f1d3c72a82ae9d4feb03d9a1a947534e.zip
Tested against code to play nice with unit tests.
Diffstat (limited to 'test')
-rw-r--r--test/unit/actions/config_test.js28
1 files changed, 25 insertions, 3 deletions
diff --git a/test/unit/actions/config_test.js b/test/unit/actions/config_test.js
index f851e4102..fea0cf0ba 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: {
@@ -30,15 +31,36 @@ describe ('config view actions', function() {
describe('SET_RPC_TARGET', function() {
it('sets the state.metamask.rpcTarget property of the state to the action.value', function() {
+ const value = {
+ rpcTarget: 'foo',
+ frequentRpcList: ['foo']
+ }
const action = {
type: actions.SET_RPC_TARGET,
- value: 'bar',
+ value,
}
var result = reducers(initialState, action)
assert.equal(result.metamask.provider.type, 'rpc')
- assert.equal(result.metamask.provider.rpcTarget, action.value)
+ assert.equal(result.metamask.provider.rpcTarget, value.rpcTarget)
+ assert.equal(result.metamask.frequentRpcList[0], value.frequentRpcList[0])
+ })
+
+ it('should handle multiple requests to change the rpc gracefully', function() {
+ const value = {
+ rpcTarget: 'foo',
+ frequentRpcList: ['foo']
+ }
+
+ const action = {
+ type: actions.SET_RPC_TARGET,
+ value,
+ }
+
+ var result = reducers(initialState, action)
+ var secondResult = reducers(result, action)
+ assert.equal(secondResult.metamask.frequentRpcList.length, 1)
})
})
-})
+})