From 91953f062b9a5b40e164eae9183c37973b1b6d31 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Wed, 20 May 2020 13:51:21 -0300 Subject: [PATCH] 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`). --- .../components/app/tests/token-cell.spec.js | 64 ------------------- .../transaction-view-balance.component.js | 4 +- .../transaction-view-balance.container.js | 2 - 3 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 ui/app/components/app/tests/token-cell.spec.js diff --git a/ui/app/components/app/tests/token-cell.spec.js b/ui/app/components/app/tests/token-cell.spec.js deleted file mode 100644 index c8b791493..000000000 --- a/ui/app/components/app/tests/token-cell.spec.js +++ /dev/null @@ -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( - - - - ) - }) - - 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') - }) - -}) diff --git a/ui/app/components/app/transaction-view-balance/transaction-view-balance.component.js b/ui/app/components/app/transaction-view-balance/transaction-view-balance.component.js index 91032b49c..b11dd0a8b 100644 --- a/ui/app/components/app/transaction-view-balance/transaction-view-balance.component.js +++ b/ui/app/components/app/transaction-view-balance/transaction-view-balance.component.js @@ -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 (
@@ -134,7 +133,6 @@ export default class TransactionViewBalance extends PureComponent { { this.renderBalance() } diff --git a/ui/app/components/app/transaction-view-balance/transaction-view-balance.container.js b/ui/app/components/app/transaction-view-balance/transaction-view-balance.container.js index 51af54df2..db9273a0d 100644 --- a/ui/app/components/app/transaction-view-balance/transaction-view-balance.container.js +++ b/ui/app/components/app/transaction-view-balance/transaction-view-balance.container.js @@ -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),