Skip to content

Commit

Permalink
fixed testcase after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
hackmod committed Oct 23, 2018
1 parent 15d5389 commit aa4d0df
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/scripts/controllers/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ class PreferencesController {
* @returns {Promise<array>} Promise resolving to updated frequentRpcList.
*
*/
addToFrequentRpcList (url, chainId, ticker, nickname) {
addToFrequentRpcList (url, chainId, ticker = 'ETH', nickname = '') {
const rpcList = this.getFrequentRpcListDetail()
const index = rpcList.findIndex((element) => { return element.rpcUrl === url })
if (index !== -1) {
Expand Down
16 changes: 8 additions & 8 deletions test/unit/app/controllers/preferences-controller-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,20 +487,20 @@ describe('preferences controller', function () {

describe('on updateFrequentRpcList', function () {
it('should add custom RPC url to state', function () {
preferencesController.addToFrequentRpcList('rpc_url')
preferencesController.addToFrequentRpcList('http://localhost:8545')
assert.deepEqual(preferencesController.store.getState().frequentRpcList, ['rpc_url'])
preferencesController.addToFrequentRpcList('rpc_url')
assert.deepEqual(preferencesController.store.getState().frequentRpcList, ['rpc_url'])
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')
assert.deepEqual(preferencesController.store.getState().frequentRpcList, ['rpc_url'])
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().frequentRpcList, [])
assert.deepEqual(preferencesController.store.getState().frequentRpcListDetail, [])
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,45 @@ describe('UserPreferencedCurrencyDisplay container', () => {
{
stateProps: {
useETHAsPrimaryCurrency: true,
fromCurrency: 'ETH',
},
ownProps: {
type: 'PRIMARY',
},
result: {
currency: 'ETH',
fromCurrency: 'ETH',
numberOfDecimals: 6,
prefix: undefined,
},
},
{
stateProps: {
useETHAsPrimaryCurrency: false,
fromCurrency: 'ETH',
},
ownProps: {
type: 'PRIMARY',
},
result: {
currency: undefined,
fromCurrency: 'ETH',
numberOfDecimals: 2,
prefix: undefined,
},
},
{
stateProps: {
useETHAsPrimaryCurrency: true,
fromCurrency: 'ETH',
},
ownProps: {
type: 'SECONDARY',
fiatNumberOfDecimals: 4,
fiatPrefix: '-',
},
result: {
fromCurrency: 'ETH',
currency: undefined,
numberOfDecimals: 4,
prefix: '-',
Expand All @@ -81,6 +87,7 @@ describe('UserPreferencedCurrencyDisplay container', () => {
{
stateProps: {
useETHAsPrimaryCurrency: false,
fromCurrency: 'ETH',
},
ownProps: {
type: 'SECONDARY',
Expand All @@ -91,6 +98,7 @@ describe('UserPreferencedCurrencyDisplay container', () => {
},
result: {
currency: 'ETH',
fromCurrency: 'ETH',
numberOfDecimals: 3,
prefix: 'b',
},
Expand Down

0 comments on commit aa4d0df

Please sign in to comment.