aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/app/controllers/preferences-controller-test.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2018-11-02 09:29:45 +0800
committerGitHub <noreply@github.com>2018-11-02 09:29:45 +0800
commit337a4e1b4ea7a560d773bc262b2adffd1617a39b (patch)
treef3c2f9b33642ef9be901645645734129686e6c6e /test/unit/app/controllers/preferences-controller-test.js
parentc2f97717c0fbf9a64cf527891f7a1f35049fb023 (diff)
parentde231c7a6191ca869308b6d27ca9cd4b020e59aa (diff)
downloadtangerine-wallet-browser-337a4e1b4ea7a560d773bc262b2adffd1617a39b.tar.gz
tangerine-wallet-browser-337a4e1b4ea7a560d773bc262b2adffd1617a39b.tar.zst
tangerine-wallet-browser-337a4e1b4ea7a560d773bc262b2adffd1617a39b.zip
Merge pull request #5649 from MetaMask/develop
Version 4.17.0
Diffstat (limited to 'test/unit/app/controllers/preferences-controller-test.js')
-rw-r--r--test/unit/app/controllers/preferences-controller-test.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/unit/app/controllers/preferences-controller-test.js b/test/unit/app/controllers/preferences-controller-test.js
index b5ccf3fb5..c64c47ae9 100644
--- a/test/unit/app/controllers/preferences-controller-test.js
+++ b/test/unit/app/controllers/preferences-controller-test.js
@@ -375,6 +375,11 @@ describe('preferences controller', function () {
await preferencesController.requestWatchAsset(req, res, asy.next, asy.end)
sandbox.assert.called(stubEnd)
sandbox.assert.notCalled(stubNext)
+ req.method = 'wallet_watchAsset'
+ req.params.type = 'someasset'
+ await preferencesController.requestWatchAsset(req, res, asy.next, asy.end)
+ sandbox.assert.calledTwice(stubEnd)
+ sandbox.assert.notCalled(stubNext)
})
it('should through error if method is supported but asset type is not', async function () {
req.method = 'metamask_watchAsset'
@@ -479,5 +484,24 @@ describe('preferences controller', function () {
assert.equal(preferencesController.store.getState().seedWords, 'foo bar baz')
})
})
+
+ describe('on updateFrequentRpcList', function () {
+ it('should add custom RPC url to state', function () {
+ preferencesController.addToFrequentRpcList('rpc_url', 1)
+ preferencesController.addToFrequentRpcList('http://localhost:8545', 1)
+ assert.deepEqual(preferencesController.store.getState().frequentRpcListDetail, [{ rpcUrl: 'rpc_url', chainId: 1, ticker: 'ETH', nickname: '' }] )
+ preferencesController.addToFrequentRpcList('rpc_url', 1)
+ assert.deepEqual(preferencesController.store.getState().frequentRpcListDetail, [{ rpcUrl: 'rpc_url', chainId: 1, ticker: 'ETH', nickname: '' }] )
+ })
+
+ it('should remove custom RPC url from state', function () {
+ preferencesController.addToFrequentRpcList('rpc_url', 1)
+ assert.deepEqual(preferencesController.store.getState().frequentRpcListDetail, [{ rpcUrl: 'rpc_url', chainId: 1, ticker: 'ETH', nickname: '' }] )
+ preferencesController.removeFromFrequentRpcList('other_rpc_url')
+ preferencesController.removeFromFrequentRpcList('http://localhost:8545')
+ preferencesController.removeFromFrequentRpcList('rpc_url')
+ assert.deepEqual(preferencesController.store.getState().frequentRpcListDetail, [])
+ })
+ })
})