diff options
I#5956 fix2 dont overwrite existing rpc settings (#6044)
* mm-controller - dont overwrite existing rpc settings
* ui-networkDropdown - dont pass old network as chainId
* add methods preferencesController.updateRpc and metamaskController.updateAndSetCustomRpc
* use updateAndSetCustomRpc in settings to allow rpcs to be updated
* use new rpc as nickname if no nick name has been supplied
* fix update rpc method
Diffstat (limited to 'test/unit/app/controllers/preferences-controller-test.js')
-rw-r--r-- | test/unit/app/controllers/preferences-controller-test.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/app/controllers/preferences-controller-test.js b/test/unit/app/controllers/preferences-controller-test.js index 67d1875c1..558597ae7 100644 --- a/test/unit/app/controllers/preferences-controller-test.js +++ b/test/unit/app/controllers/preferences-controller-test.js @@ -511,6 +511,18 @@ describe('preferences controller', function () { }) }) + describe('#updateRpc', function () { + it('should update the rpcDetails properly', () => { + preferencesController.store.updateState({frequentRpcListDetail: [{}, { rpcUrl: 'test' }, {}]}) + preferencesController.updateRpc({ rpcUrl: 'test', chainId: 1 }) + preferencesController.updateRpc({ rpcUrl: 'test/1', chainId: 1 }) + preferencesController.updateRpc({ rpcUrl: 'test/2', chainId: 1 }) + preferencesController.updateRpc({ rpcUrl: 'test/3', chainId: 1 }) + const list = preferencesController.getFrequentRpcListDetail() + assert.deepEqual(list[1], { rpcUrl: 'test', chainId: 1 }) + }) + }) + describe('on updateFrequentRpcList', function () { it('should add custom RPC url to state', function () { preferencesController.addToFrequentRpcList('rpc_url', 1) |