Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the repeated getSelectedAddress() func send.selectors.js is removed #6056

Merged
merged 3 commits into from
Apr 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ui/app/components/app/send/send.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { connect } from 'react-redux'
import SendEther from './send.component'
import { withRouter } from 'react-router-dom'
import { compose } from 'recompose'
const {
getSelectedAddress,
} = require('../../../selectors/selectors')

import {
getAmountConversionRate,
getBlockGasLimit,
Expand All @@ -12,7 +16,6 @@ import {
getGasTotal,
getPrimaryCurrency,
getRecentBlocks,
getSelectedAddress,
getSelectedToken,
getSelectedTokenContract,
getSelectedTokenToFiatRate,
Expand Down
8 changes: 1 addition & 7 deletions ui/app/components/app/send/send.selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const {
} = require('../../../helpers/utils/conversion-util')
const {
getMetaMaskAccounts,
getSelectedAddress,
} = require('../../../selectors/selectors')
const {
estimateGasPriceFromRecentBlocks,
Expand Down Expand Up @@ -33,7 +34,6 @@ const selectors = {
getPrimaryCurrency,
getRecentBlocks,
getSelectedAccount,
getSelectedAddress,
getSelectedIdentity,
getSelectedToken,
getSelectedTokenContract,
Expand Down Expand Up @@ -149,12 +149,6 @@ function getSelectedAccount (state) {
return accounts[selectedAddress]
}

function getSelectedAddress (state) {
const selectedAddress = state.metamask.selectedAddress || Object.keys(getMetaMaskAccounts(state))[0]

return selectedAddress
}

function getSelectedIdentity (state) {
const selectedAddress = getSelectedAddress(state)
const identities = state.metamask.identities
Expand Down
5 changes: 4 additions & 1 deletion ui/app/components/app/send/tests/send-container.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ proxyquire('../send.container.js', {
getGasTotal: (s) => `mockGasTotal:${s}`,
getPrimaryCurrency: (s) => `mockPrimaryCurrency:${s}`,
getRecentBlocks: (s) => `mockRecentBlocks:${s}`,
getSelectedAddress: (s) => `mockSelectedAddress:${s}`,
getSelectedToken: (s) => `mockSelectedToken:${s}`,
getSelectedTokenContract: (s) => `mockTokenContract:${s}`,
getSelectedTokenToFiatRate: (s) => `mockTokenToFiatRate:${s}`,
Expand All @@ -47,11 +46,15 @@ proxyquire('../send.container.js', {
getTokenBalance: (s) => `mockTokenBalance:${s}`,
getQrCodeData: (s) => `mockQrCodeData:${s}`,
},
'../../../selectors/selectors': {
getSelectedAddress: (s) => `mockSelectedAddress:${s}`,
},
'../../../store/actions': actionSpies,
'../../../ducks/send/send.duck': duckActionSpies,
'./send.utils.js': {
calcGasTotal: (gasLimit, gasPrice) => gasLimit + gasPrice,
},

})

describe('send container', () => {
Expand Down
9 changes: 0 additions & 9 deletions ui/app/components/app/send/tests/send-selectors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const {
getPrimaryCurrency,
getRecentBlocks,
getSelectedAccount,
getSelectedAddress,
getSelectedIdentity,
getSelectedToken,
getSelectedTokenContract,
Expand Down Expand Up @@ -274,14 +273,6 @@ describe('send selectors', () => {
})
})

describe('getSelectedAddress()', () => {
it('should', () => {
assert.equal(
getSelectedAddress(mockState),
'0xd85a4b6a394794842887b8284293d69163007bbb'
)
})
})

describe('getSelectedIdentity()', () => {
it('should return the identity object of the currently selected address', () => {
Expand Down