1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

Remove unused network prop (#8633)

The `Identicon` component was being passed a `network` prop, despite
not accepting a `network` prop.

A duplicate set of `token-cell` tests have also been deleted, as they
used this prop. The tests were never run, because the file was misnamed
(it needs to be named `.test.js`).
This commit is contained in:
Mark Stacey 2020-05-20 13:51:21 -03:00 committed by GitHub
parent f748664638
commit 91953f062b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 69 deletions

View File

@ -1,64 +0,0 @@
import React from 'react'
import assert from 'assert'
import thunk from 'redux-thunk'
import { Provider } from 'react-redux'
import configureMockStore from 'redux-mock-store'
import { mount } from 'enzyme'
import TokenCell from '../token-cell'
import Identicon from '../../ui/identicon'
describe('Token Cell', function () {
let wrapper
const state = {
metamask: {
network: 'test',
currentCurrency: 'usd',
selectedTokenAddress: '0xToken',
selectedAddress: '0xAddress',
contractExchangeRates: {
'0xAnotherToken': 0.015,
},
conversionRate: 7.00,
},
}
const middlewares = [thunk]
const mockStore = configureMockStore(middlewares)
const store = mockStore(state)
beforeEach(function () {
wrapper = mount(
<Provider store={store}>
<TokenCell
address="0xAnotherToken"
symbol="TEST"
string="5.000"
network={22}
currentCurrency="usd"
image="./test-image"
/>
</Provider>
)
})
it('renders Identicon with props from token cell', function () {
assert.equal(wrapper.find(Identicon).prop('address'), '0xAnotherToken')
assert.equal(wrapper.find(Identicon).prop('network'), 'test')
assert.equal(wrapper.find(Identicon).prop('image'), './test-image')
})
it('renders token balance', function () {
assert.equal(wrapper.find('.token-cell__token-balance').text(), '5.000')
})
it('renders token symbol', function () {
assert.equal(wrapper.find('.token-cell__token-symbol').text(), 'TEST')
})
it('renders converted fiat amount', function () {
assert.equal(wrapper.find('.token-cell__fiat-amount').text(), '0.52 USD')
})
})

View File

@ -19,7 +19,6 @@ export default class TransactionViewBalance extends PureComponent {
showDepositModal: PropTypes.func,
selectedToken: PropTypes.object,
history: PropTypes.object,
network: PropTypes.string,
balance: PropTypes.string,
assetImage: PropTypes.string,
balanceIsCached: PropTypes.bool,
@ -126,7 +125,7 @@ export default class TransactionViewBalance extends PureComponent {
}
render () {
const { network, selectedToken, assetImage } = this.props
const { selectedToken, assetImage } = this.props
return (
<div className="transaction-view-balance">
@ -134,7 +133,6 @@ export default class TransactionViewBalance extends PureComponent {
<Identicon
diameter={50}
address={selectedToken && selectedToken.address}
network={network}
image={assetImage}
/>
{ this.renderBalance() }

View File

@ -18,14 +18,12 @@ const mapStateToProps = (state) => {
const { showFiatInTestnets } = preferencesSelector(state)
const isMainnet = getIsMainnet(state)
const selectedAddress = getSelectedAddress(state)
const { metamask: { network } } = state
const accounts = getMetaMaskAccounts(state)
const account = accounts[selectedAddress]
const { balance } = account
return {
selectedToken: getSelectedToken(state),
network,
balance,
nativeCurrency: getNativeCurrency(state),
assetImage: getSelectedTokenAssetImage(state),