From c11888f2877a44cbf6d9fe7c83b3dbe0d5b7d839 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Fri, 14 Aug 2020 09:17:02 -0230 Subject: [PATCH] Fix no-empty-function issues (#9216) See [`no-empty-function`](https://eslint.org/docs/rules/no-empty-function) for more information. This change enables `no-empty-function` and fixes the issues raised by the rule. --- .eslintrc.js | 1 + app/scripts/controllers/app-state.js | 2 +- app/scripts/controllers/permissions/index.js | 4 ++-- development/mock-3box.js | 2 +- test/helper.js | 2 +- test/lib/render-helpers.js | 2 +- test/unit-global/frozenPromise.js | 2 +- test/unit/app/controllers/cached-balances-test.js | 6 +++--- test/unit/app/controllers/detect-tokens-test.js | 2 +- .../app/controllers/metamask-controller-test.js | 6 +++--- .../controllers/network/network-controller-test.js | 2 +- test/unit/app/controllers/permissions/mocks.js | 2 +- .../app/controllers/preferences-controller-test.js | 10 +++++----- .../transactions/pending-tx-tracker-test.js | 6 +++--- .../controllers/transactions/tx-controller-test.js | 2 +- .../controllers/transactions/tx-gas-util-test.js | 2 +- test/unit/app/message-manager-test.js | 3 --- test/unit/app/personal-message-manager-test.js | 3 --- test/unit/ui/app/actions.spec.js | 2 +- .../app/app-header/tests/app-header.test.js | 10 +++++----- .../app/modal/tests/modal.component.test.js | 8 ++++---- .../tests/cancel-transaction.component.test.js | 2 +- ui/app/components/app/modals/fade-modal.js | 4 ++-- .../tests/metametrics-opt-in-modal.test.js | 2 +- .../tests/selected-account-component.test.js | 2 +- .../tests/signature-request.test.js | 6 +++--- .../transaction-activity-log.component.test.js | 12 ++++++------ .../transaction-breakdown-row.component.test.js | 2 +- ...transaction-list-item-details.component.test.js | 8 ++++---- ui/app/hooks/tests/useCancelTransaction.test.js | 4 ++-- ui/app/hooks/tests/useRetryTransaction.test.js | 2 +- ui/app/pages/add-token/tests/add-token.test.js | 2 +- .../tests/reveal-seed-phrase.test.js | 2 +- .../tests/amount-max-button-component.test.js | 4 ++-- .../tests/send-amount-row-component.test.js | 2 +- .../tests/send-footer-component.test.js | 2 +- ui/app/pages/send/tests/send-component.test.js | 10 +++++----- ui/app/pages/send/tests/send-container.test.js | 2 +- .../tests/advanced-tab-component.test.js | 14 +++++++------- .../security-tab/tests/security-tab.test.js | 2 +- 40 files changed, 79 insertions(+), 84 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 4748f627c..94ddd7bef 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -53,6 +53,7 @@ module.exports = { 'no-constant-condition': 'error', 'no-dupe-else-if': 'error', 'no-empty': 'error', + 'no-empty-function': 'error', 'no-eq-null': 'error', 'no-global-assign': 'error', 'no-loop-func': 'error', diff --git a/app/scripts/controllers/app-state.js b/app/scripts/controllers/app-state.js index 17bae2973..a9414cea4 100644 --- a/app/scripts/controllers/app-state.js +++ b/app/scripts/controllers/app-state.js @@ -19,7 +19,7 @@ export default class AppStateController extends EventEmitter { super() - this.onInactiveTimeout = onInactiveTimeout || (() => {}) + this.onInactiveTimeout = onInactiveTimeout || (() => undefined) this.store = new ObservableStore(Object.assign({ timeoutMinutes: 0, connectedStatusPopoverHasBeenShown: true, diff --git a/app/scripts/controllers/permissions/index.js b/app/scripts/controllers/permissions/index.js index a5aeb7b14..f82cb1c75 100644 --- a/app/scripts/controllers/permissions/index.js +++ b/app/scripts/controllers/permissions/index.js @@ -132,7 +132,7 @@ export class PermissionsController { const req = { method: 'eth_accounts' } const res = {} this.permissions.providerMiddlewareFunction( - { origin }, req, res, () => {}, _end, + { origin }, req, res, () => undefined, _end, ) function _end () { @@ -187,7 +187,7 @@ export class PermissionsController { const res = {} this.permissions.providerMiddlewareFunction( - domain, req, res, () => {}, _end, + domain, req, res, () => undefined, _end, ) function _end (_err) { diff --git a/development/mock-3box.js b/development/mock-3box.js index 89cf20ab1..37ff02c7b 100644 --- a/development/mock-3box.js +++ b/development/mock-3box.js @@ -50,7 +50,7 @@ class Mock3Box { }, } }, - logout: () => {}, + logout: () => undefined, }) } diff --git a/test/helper.js b/test/helper.js index ea44bee48..50ec1f2d8 100644 --- a/test/helper.js +++ b/test/helper.js @@ -80,7 +80,7 @@ require('abortcontroller-polyfill/dist/polyfill-patch-fetch') window.localStorage = {} // override metamask-logo -window.requestAnimationFrame = () => {} +window.requestAnimationFrame = () => undefined // crypto.getRandomValues if (!window.crypto) { diff --git a/test/lib/render-helpers.js b/test/lib/render-helpers.js index 3671ad129..2224c2165 100644 --- a/test/lib/render-helpers.js +++ b/test/lib/render-helpers.js @@ -27,7 +27,7 @@ export function mountWithRouter (component, store = {}, pathname = '/') { context: { router, t: (str) => str, - metricsEvent: () => {}, + metricsEvent: () => undefined, store, }, childContextTypes: { diff --git a/test/unit-global/frozenPromise.js b/test/unit-global/frozenPromise.js index 74da3b01b..594c1350a 100644 --- a/test/unit-global/frozenPromise.js +++ b/test/unit-global/frozenPromise.js @@ -25,7 +25,7 @@ describe('Promise global is immutable', function () { it('throws when mutating existing Promise property', function () { try { - Promise.all = () => {} + Promise.all = () => undefined assert.fail('did not throw error') } catch (err) { assert.ok(err, 'did throw error') diff --git a/test/unit/app/controllers/cached-balances-test.js b/test/unit/app/controllers/cached-balances-test.js index 272334dc5..f954da63f 100644 --- a/test/unit/app/controllers/cached-balances-test.js +++ b/test/unit/app/controllers/cached-balances-test.js @@ -9,7 +9,7 @@ describe('CachedBalancesController', function () { getNetwork: () => Promise.resolve(17), accountTracker: { store: { - subscribe: () => {}, + subscribe: () => undefined, }, }, initState: { @@ -32,7 +32,7 @@ describe('CachedBalancesController', function () { const controller = new CachedBalancesController({ accountTracker: { store: { - subscribe: () => {}, + subscribe: () => undefined, }, }, initState: { @@ -75,7 +75,7 @@ describe('CachedBalancesController', function () { const controller = new CachedBalancesController({ accountTracker: { store: { - subscribe: () => {}, + subscribe: () => undefined, }, }, initState: { diff --git a/test/unit/app/controllers/detect-tokens-test.js b/test/unit/app/controllers/detect-tokens-test.js index ee2418856..22bc37958 100644 --- a/test/unit/app/controllers/detect-tokens-test.js +++ b/test/unit/app/controllers/detect-tokens-test.js @@ -14,7 +14,7 @@ describe('DetectTokensController', function () { const sandbox = sinon.createSandbox() let keyringMemStore, network, preferences - const noop = () => {} + const noop = () => undefined const networkControllerProviderConfig = { getAccounts: noop, diff --git a/test/unit/app/controllers/metamask-controller-test.js b/test/unit/app/controllers/metamask-controller-test.js index 6f6ac0a34..f2556bde2 100644 --- a/test/unit/app/controllers/metamask-controller-test.js +++ b/test/unit/app/controllers/metamask-controller-test.js @@ -19,7 +19,7 @@ import proxyquire from 'proxyquire' class ThreeBoxControllerMock { constructor () { this.store = { - subscribe: () => {}, + subscribe: () => undefined, getState: () => ({}), } this.init = threeBoxSpies.init @@ -78,7 +78,7 @@ const CUSTOM_RPC_URL = 'http://localhost:8545' describe('MetaMaskController', function () { let metamaskController const sandbox = sinon.createSandbox() - const noop = () => {} + const noop = () => undefined beforeEach(function () { @@ -113,7 +113,7 @@ describe('MetaMaskController', function () { }, }, initState: cloneDeep(firstTimeState), - platform: { showTransactionNotification: () => {} }, + platform: { showTransactionNotification: () => undefined }, }) // disable diagnostics metamaskController.diagnostics = null diff --git a/test/unit/app/controllers/network/network-controller-test.js b/test/unit/app/controllers/network/network-controller-test.js index 08164d99d..be1c7f536 100644 --- a/test/unit/app/controllers/network/network-controller-test.js +++ b/test/unit/app/controllers/network/network-controller-test.js @@ -6,7 +6,7 @@ import { getNetworkDisplayName } from '../../../../../app/scripts/controllers/ne describe('NetworkController', function () { describe('controller', function () { let networkController - const noop = () => {} + const noop = () => undefined const networkControllerProviderConfig = { getAccounts: noop, } diff --git a/test/unit/app/controllers/permissions/mocks.js b/test/unit/app/controllers/permissions/mocks.js index 5302d9f61..65b311182 100644 --- a/test/unit/app/controllers/permissions/mocks.js +++ b/test/unit/app/controllers/permissions/mocks.js @@ -20,7 +20,7 @@ import { * - Immutable mock values like Ethereum accounts and expected states */ -export const noop = () => {} +export const noop = () => undefined /** * Mock Permissions Controller and Middleware diff --git a/test/unit/app/controllers/preferences-controller-test.js b/test/unit/app/controllers/preferences-controller-test.js index ee4a09ab6..f0091d35a 100644 --- a/test/unit/app/controllers/preferences-controller-test.js +++ b/test/unit/app/controllers/preferences-controller-test.js @@ -372,7 +372,7 @@ describe('preferences controller', function () { beforeEach(function () { req = { params: {} } res = {} - asy = { next: () => {}, end: () => {} } + asy = { next: () => undefined, end: () => undefined } stubNext = sandbox.stub(asy, 'next') stubEnd = sandbox.stub(asy, 'end').returns(0) stubHandleWatchAssetERC20 = sandbox.stub(preferencesController, '_handleWatchAssetERC20') @@ -382,7 +382,7 @@ describe('preferences controller', function () { }) it('shouldn not do anything if method not corresponds', async function () { - const asy = { next: () => {}, end: () => {} } + const asy = { next: () => undefined, end: () => undefined } const stubNext = sandbox.stub(asy, 'next') const stubEnd = sandbox.stub(asy, 'end').returns(0) req.method = 'metamask' @@ -391,7 +391,7 @@ describe('preferences controller', function () { sandbox.assert.called(stubNext) }) it('should do something if method is supported', async function () { - const asy = { next: () => {}, end: () => {} } + const asy = { next: () => undefined, end: () => undefined } const stubNext = sandbox.stub(asy, 'next') const stubEnd = sandbox.stub(asy, 'end').returns(0) req.method = 'metamask_watchAsset' @@ -415,7 +415,7 @@ describe('preferences controller', function () { assert.deepEqual(res, {}) }) it('should trigger handle add asset if type supported', async function () { - const asy = { next: () => {}, end: () => {} } + const asy = { next: () => undefined, end: () => undefined } req.method = 'metamask_watchAsset' req.params.type = 'ERC20' await preferencesController.requestWatchAsset(req, res, asy.next, asy.end) @@ -442,7 +442,7 @@ describe('preferences controller', function () { req.params.options = { address, symbol, decimals, image } sandbox.stub(preferencesController, '_validateERC20AssetParams').returns(true) - preferencesController.openPopup = async () => {} + preferencesController.openPopup = async () => undefined await preferencesController._handleWatchAssetERC20(req.params.options) const suggested = preferencesController.getSuggestedTokens() diff --git a/test/unit/app/controllers/transactions/pending-tx-tracker-test.js b/test/unit/app/controllers/transactions/pending-tx-tracker-test.js index facc0bb12..000ad263d 100644 --- a/test/unit/app/controllers/transactions/pending-tx-tracker-test.js +++ b/test/unit/app/controllers/transactions/pending-tx-tracker-test.js @@ -147,15 +147,15 @@ describe('PendingTransactionTracker', function () { }, nonceTracker: { getGlobalLock: async () => { - return { releaseLock: () => {} } + return { releaseLock: () => undefined } }, }, getPendingTransactions: () => txList, getCompletedTransactions: () => { return [] }, - publishTransaction: () => {}, - confirmTransaction: () => {}, + publishTransaction: () => undefined, + confirmTransaction: () => undefined, }) const checkPendingTxStub = sinon.stub(pendingTxTracker, '_checkPendingTx').resolves() diff --git a/test/unit/app/controllers/transactions/tx-controller-test.js b/test/unit/app/controllers/transactions/tx-controller-test.js index 7c559172a..b3649a9b3 100644 --- a/test/unit/app/controllers/transactions/tx-controller-test.js +++ b/test/unit/app/controllers/transactions/tx-controller-test.js @@ -47,7 +47,7 @@ describe('Transaction Controller', function () { ethTx.sign(fromAccount.key) resolve() }), - getPermittedAccounts: () => {}, + getPermittedAccounts: () => undefined, }) txController.nonceTracker.getNonceLock = () => Promise.resolve({ nextNonce: 0, releaseLock: noop }) }) diff --git a/test/unit/app/controllers/transactions/tx-gas-util-test.js b/test/unit/app/controllers/transactions/tx-gas-util-test.js index 615a25527..21ba62746 100644 --- a/test/unit/app/controllers/transactions/tx-gas-util-test.js +++ b/test/unit/app/controllers/transactions/tx-gas-util-test.js @@ -9,7 +9,7 @@ describe('txUtils', function () { before(function () { txUtils = new TxUtils(new Proxy({}, { get: () => { - return () => {} + return () => undefined }, })) }) diff --git a/test/unit/app/message-manager-test.js b/test/unit/app/message-manager-test.js index 8c499c97d..66eef7b10 100644 --- a/test/unit/app/message-manager-test.js +++ b/test/unit/app/message-manager-test.js @@ -14,9 +14,6 @@ describe('Message Manager', function () { assert.ok(Array.isArray(result)) assert.equal(result.length, 0) }) - it('should also return transactions from local storage if any', function () { - - }) }) describe('#addMsg', function () { diff --git a/test/unit/app/personal-message-manager-test.js b/test/unit/app/personal-message-manager-test.js index 9e5aaaba1..d95ca5e14 100644 --- a/test/unit/app/personal-message-manager-test.js +++ b/test/unit/app/personal-message-manager-test.js @@ -14,9 +14,6 @@ describe('Personal Message Manager', function () { assert.ok(Array.isArray(result)) assert.equal(result.length, 0) }) - it('should also return transactions from local storage if any', function () { - - }) }) describe('#addMsg', function () { diff --git a/test/unit/ui/app/actions.spec.js b/test/unit/ui/app/actions.spec.js index 6eb2e6007..c25586950 100644 --- a/test/unit/ui/app/actions.spec.js +++ b/test/unit/ui/app/actions.spec.js @@ -19,7 +19,7 @@ const mockStore = (state = defaultState) => configureStore(middleware)(state) describe('Actions', function () { - const noop = () => {} + const noop = () => undefined const currentNetworkId = '42' diff --git a/ui/app/components/app/app-header/tests/app-header.test.js b/ui/app/components/app/app-header/tests/app-header.test.js index 0ada978da..ece8e498c 100644 --- a/ui/app/components/app/app-header/tests/app-header.test.js +++ b/ui/app/components/app/app-header/tests/app-header.test.js @@ -30,7 +30,7 @@ describe('App Header', function () { , { context: { t: (str) => str, - metricsEvent: () => {}, + metricsEvent: () => undefined, }, }, ) @@ -54,8 +54,8 @@ describe('App Header', function () { const network = wrapper.find({ network: 'test' }) network.simulate('click', { - preventDefault: () => {}, - stopPropagation: () => {}, + preventDefault: () => undefined, + stopPropagation: () => undefined, }) assert(props.showNetworkDropdown.calledOnce) @@ -66,8 +66,8 @@ describe('App Header', function () { const network = wrapper.find({ network: 'test' }) network.simulate('click', { - preventDefault: () => {}, - stopPropagation: () => {}, + preventDefault: () => undefined, + stopPropagation: () => undefined, }) assert(props.hideNetworkDropdown.calledOnce) diff --git a/ui/app/components/app/modal/tests/modal.component.test.js b/ui/app/components/app/modal/tests/modal.component.test.js index 83d9a81e7..dbb615233 100644 --- a/ui/app/components/app/modal/tests/modal.component.test.js +++ b/ui/app/components/app/modal/tests/modal.component.test.js @@ -48,10 +48,10 @@ describe('Modal Component', function () { it('should render a modal with different button types', function () { const wrapper = shallow( {}} + onCancel={() => undefined} cancelText="Cancel" cancelType="secondary" - onSubmit={() => {}} + onSubmit={() => undefined} submitText="Submit" submitType="confirm" />, @@ -66,9 +66,9 @@ describe('Modal Component', function () { it('should render a modal with children', function () { const wrapper = shallow( {}} + onCancel={() => undefined} cancelText="Cancel" - onSubmit={() => {}} + onSubmit={() => undefined} submitText="Submit" >
diff --git a/ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js b/ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js index 416b796bc..3ccf6bda0 100644 --- a/ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js +++ b/ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js @@ -34,7 +34,7 @@ describe('CancelTransaction Component', function () { defaultNewGasPrice="0x3b9aca00" createCancelTransaction={createCancelTransactionSpy} hideModal={hideModalSpy} - showTransactionConfirmedModal={() => {}} + showTransactionConfirmedModal={() => undefined} />, { context: { t } }, ) diff --git a/ui/app/components/app/modals/fade-modal.js b/ui/app/components/app/modals/fade-modal.js index 5b993e40e..3d12414d4 100644 --- a/ui/app/components/app/modals/fade-modal.js +++ b/ui/app/components/app/modals/fade-modal.js @@ -134,8 +134,8 @@ class FadeModal extends Component { } static defaultProps = { - onShow: function () {}, - onHide: function () {}, + onShow: () => undefined, + onHide: () => undefined, keyboard: true, backdrop: true, closeOnClick: true, diff --git a/ui/app/components/app/modals/metametrics-opt-in-modal/tests/metametrics-opt-in-modal.test.js b/ui/app/components/app/modals/metametrics-opt-in-modal/tests/metametrics-opt-in-modal.test.js index 70e7d9924..0d2787ebc 100644 --- a/ui/app/components/app/modals/metametrics-opt-in-modal/tests/metametrics-opt-in-modal.test.js +++ b/ui/app/components/app/modals/metametrics-opt-in-modal/tests/metametrics-opt-in-modal.test.js @@ -17,7 +17,7 @@ describe('MetaMetrics Opt In', function () { wrapper = mount( , { context: { - metricsEvent: () => {}, + metricsEvent: () => undefined, }, }, ) diff --git a/ui/app/components/app/selected-account/tests/selected-account-component.test.js b/ui/app/components/app/selected-account/tests/selected-account-component.test.js index 73b659e10..323ead37b 100644 --- a/ui/app/components/app/selected-account/tests/selected-account-component.test.js +++ b/ui/app/components/app/selected-account/tests/selected-account-component.test.js @@ -9,7 +9,7 @@ describe('SelectedAccount Component', function () { - ), { context: { t: () => {} } }) + ), { context: { t: () => undefined } }) // Checksummed version of address is displayed assert.equal(wrapper.find('.selected-account__address').text(), '0x1B82...5C9D') assert.equal(wrapper.find('.selected-account__name').text(), 'testName') diff --git a/ui/app/components/app/signature-request/tests/signature-request.test.js b/ui/app/components/app/signature-request/tests/signature-request.test.js index f3b717ec4..8956a957d 100644 --- a/ui/app/components/app/signature-request/tests/signature-request.test.js +++ b/ui/app/components/app/signature-request/tests/signature-request.test.js @@ -10,9 +10,9 @@ describe('Signature Request Component', function () { it('should render a div with one child', function () { const wrapper = shallow(( {}} - cancel={() => {}} - sign={() => {}} + clearConfirmTransaction={() => undefined} + cancel={() => undefined} + sign={() => undefined} txData={{ msgParams: { data: '{"message": {"from": {"name": "hello"}}}', diff --git a/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.component.test.js b/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.component.test.js index c3422e58e..99947104c 100644 --- a/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.component.test.js +++ b/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.component.test.js @@ -40,8 +40,8 @@ describe('TransactionActivityLog Component', function () { inlineRetryIndex={-1} inlineCancelIndex={-1} nativeCurrency="ETH" - onCancel={() => {}} - onRetry={() => {}} + onCancel={() => undefined} + onRetry={() => undefined} primaryTransactionStatus="confirmed" />, { context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }, @@ -87,8 +87,8 @@ describe('TransactionActivityLog Component', function () { inlineRetryIndex={2} inlineCancelIndex={3} nativeCurrency="ETH" - onCancel={() => {}} - onRetry={() => {}} + onCancel={() => undefined} + onRetry={() => undefined} primaryTransactionStatus="pending" isEarliestNonce />, @@ -136,8 +136,8 @@ describe('TransactionActivityLog Component', function () { inlineRetryIndex={2} inlineCancelIndex={3} nativeCurrency="ETH" - onCancel={() => {}} - onRetry={() => {}} + onCancel={() => undefined} + onRetry={() => undefined} primaryTransactionStatus="pending" isEarliestNonce={false} />, diff --git a/ui/app/components/app/transaction-breakdown/transaction-breakdown-row/tests/transaction-breakdown-row.component.test.js b/ui/app/components/app/transaction-breakdown/transaction-breakdown-row/tests/transaction-breakdown-row.component.test.js index f9e144a42..752d8b6af 100644 --- a/ui/app/components/app/transaction-breakdown/transaction-breakdown-row/tests/transaction-breakdown-row.component.test.js +++ b/ui/app/components/app/transaction-breakdown/transaction-breakdown-row/tests/transaction-breakdown-row.component.test.js @@ -27,7 +27,7 @@ describe('TransactionBreakdownRow Component', function () { title="test" className="test-class" > - + , { context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }, ) diff --git a/ui/app/components/app/transaction-list-item-details/tests/transaction-list-item-details.component.test.js b/ui/app/components/app/transaction-list-item-details/tests/transaction-list-item-details.component.test.js index 0c9726aef..f0e3edf4d 100644 --- a/ui/app/components/app/transaction-list-item-details/tests/transaction-list-item-details.component.test.js +++ b/ui/app/components/app/transaction-list-item-details/tests/transaction-list-item-details.component.test.js @@ -34,7 +34,7 @@ describe('TransactionListItemDetails Component', function () { title="Test Transaction Details" recipientAddress="0x1" senderAddress="0x2" - tryReverseResolveAddress={() => {}} + tryReverseResolveAddress={() => undefined} transactionGroup={transactionGroup} senderNickname="sender-nickname" recipientNickname="recipient-nickname" @@ -77,7 +77,7 @@ describe('TransactionListItemDetails Component', function () { {}} + tryReverseResolveAddress={() => undefined} transactionGroup={transactionGroup} showSpeedUp senderNickname="sender-nickname" @@ -117,7 +117,7 @@ describe('TransactionListItemDetails Component', function () { {}} + tryReverseResolveAddress={() => undefined} transactionGroup={transactionGroup} senderNickname="sender-nickname" recipientNickname="recipient-nickname" @@ -159,7 +159,7 @@ describe('TransactionListItemDetails Component', function () { {}} + tryReverseResolveAddress={() => undefined} transactionGroup={transactionGroup} senderNickname="sender-nickname" recipientNickname="recipient-nickname" diff --git a/ui/app/hooks/tests/useCancelTransaction.test.js b/ui/app/hooks/tests/useCancelTransaction.test.js index be2256cd9..920b9e223 100644 --- a/ui/app/hooks/tests/useCancelTransaction.test.js +++ b/ui/app/hooks/tests/useCancelTransaction.test.js @@ -46,7 +46,7 @@ describe('useCancelTransaction', function () { it(`should return a function that kicks off cancellation for id ${transactionId}`, function () { const { result } = renderHook(() => useCancelTransaction(transactionGroup)) assert.equal(typeof result.current[1], 'function') - result.current[1]({ preventDefault: () => {}, stopPropagation: () => {} }) + result.current[1]({ preventDefault: () => undefined, stopPropagation: () => undefined }) assert.equal( dispatch.calledWith( showModal({ @@ -90,7 +90,7 @@ describe('useCancelTransaction', function () { it(`should return a function that kicks off cancellation for id ${transactionId}`, function () { const { result } = renderHook(() => useCancelTransaction(transactionGroup)) assert.equal(typeof result.current[1], 'function') - result.current[1]({ preventDefault: () => {}, stopPropagation: () => {} }) + result.current[1]({ preventDefault: () => undefined, stopPropagation: () => undefined }) assert.equal( dispatch.calledWith( showModal({ diff --git a/ui/app/hooks/tests/useRetryTransaction.test.js b/ui/app/hooks/tests/useRetryTransaction.test.js index d6c55d0f8..e4e8160a8 100644 --- a/ui/app/hooks/tests/useRetryTransaction.test.js +++ b/ui/app/hooks/tests/useRetryTransaction.test.js @@ -12,7 +12,7 @@ describe('useRetryTransaction', function () { describe('when transaction meets retry enabled criteria', function () { const dispatch = sinon.spy(() => Promise.resolve({ blockTime: 0 })) const trackEvent = sinon.spy() - const event = { preventDefault: () => {}, stopPropagation: () => {} } + const event = { preventDefault: () => undefined, stopPropagation: () => undefined } before(function () { sinon.stub(reactRedux, 'useDispatch').returns(dispatch) diff --git a/ui/app/pages/add-token/tests/add-token.test.js b/ui/app/pages/add-token/tests/add-token.test.js index fa9e4bd19..da4a42f20 100644 --- a/ui/app/pages/add-token/tests/add-token.test.js +++ b/ui/app/pages/add-token/tests/add-token.test.js @@ -19,7 +19,7 @@ describe('Add Token', function () { const props = { history: { - push: sinon.stub().callsFake(() => {}), + push: sinon.stub().callsFake(() => undefined), }, setPendingTokens: sinon.spy(), clearPendingTokens: sinon.spy(), diff --git a/ui/app/pages/first-time-flow/seed-phrase/reveal-seed-phrase/tests/reveal-seed-phrase.test.js b/ui/app/pages/first-time-flow/seed-phrase/reveal-seed-phrase/tests/reveal-seed-phrase.test.js index a9ac7b66c..dfc045778 100644 --- a/ui/app/pages/first-time-flow/seed-phrase/reveal-seed-phrase/tests/reveal-seed-phrase.test.js +++ b/ui/app/pages/first-time-flow/seed-phrase/reveal-seed-phrase/tests/reveal-seed-phrase.test.js @@ -23,7 +23,7 @@ describe('Reveal Seed Phrase', function () { , { context: { t: (str) => str, - metricsEvent: () => {}, + metricsEvent: () => undefined, }, }, ) diff --git a/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js b/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js index 0b964dfca..008bcec30 100644 --- a/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js +++ b/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js @@ -13,7 +13,7 @@ describe('AmountMaxButton Component', function () { setMaxModeTo: sinon.spy(), } - const MOCK_EVENT = { preventDefault: () => {} } + const MOCK_EVENT = { preventDefault: () => undefined } before(function () { sinon.spy(AmountMaxButton.prototype, 'setMaxAmount') @@ -33,7 +33,7 @@ describe('AmountMaxButton Component', function () { ), { context: { t: (str) => str + '_t', - metricsEvent: () => {}, + metricsEvent: () => undefined, }, }) instance = wrapper.instance() diff --git a/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-component.test.js b/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-component.test.js index 4f99b8909..b22819f25 100644 --- a/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-component.test.js +++ b/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-component.test.js @@ -158,7 +158,7 @@ function shallowRenderSendAmountRow () { updateGasFeeError={updateGasFeeError} updateSendAmount={updateSendAmount} updateSendAmountError={updateSendAmountError} - updateGas={() => {}} + updateGas={() => undefined} /> ), { context: { t: (str) => str + '_t' } }) const instance = wrapper.instance() diff --git a/ui/app/pages/send/send-footer/tests/send-footer-component.test.js b/ui/app/pages/send/send-footer/tests/send-footer-component.test.js index d200e2dd7..ba2c8c1e5 100644 --- a/ui/app/pages/send/send-footer/tests/send-footer-component.test.js +++ b/ui/app/pages/send/send-footer/tests/send-footer-component.test.js @@ -18,7 +18,7 @@ describe('SendFooter Component', function () { const historySpies = { push: sinon.spy(), } - const MOCK_EVENT = { preventDefault: () => {} } + const MOCK_EVENT = { preventDefault: () => undefined } before(function () { sinon.spy(SendFooter.prototype, 'onCancel') diff --git a/ui/app/pages/send/tests/send-component.test.js b/ui/app/pages/send/tests/send-component.test.js index 757b8fa63..43c296009 100644 --- a/ui/app/pages/send/tests/send-component.test.js +++ b/ui/app/pages/send/tests/send-component.test.js @@ -63,12 +63,12 @@ describe('Send Component', function () { tokenBalance="mockTokenBalance" tokenContract={{ method: 'mockTokenMethod' }} updateAndSetGasLimit={propsMethodSpies.updateAndSetGasLimit} - qrCodeDetected={() => {}} - scanQrCode={() => {}} - updateSendEnsResolution={() => {}} - updateSendEnsResolutionError={() => {}} + qrCodeDetected={() => undefined} + scanQrCode={() => undefined} + updateSendEnsResolution={() => undefined} + updateSendEnsResolutionError={() => undefined} updateSendErrors={propsMethodSpies.updateSendErrors} - updateSendTo={() => {}} + updateSendTo={() => undefined} updateSendTokenBalance={propsMethodSpies.updateSendTokenBalance} resetSendState={propsMethodSpies.resetSendState} updateToNicknameIfNecessary={propsMethodSpies.updateToNicknameIfNecessary} diff --git a/ui/app/pages/send/tests/send-container.test.js b/ui/app/pages/send/tests/send-container.test.js index 84a138d92..ae9cfd2d4 100644 --- a/ui/app/pages/send/tests/send-container.test.js +++ b/ui/app/pages/send/tests/send-container.test.js @@ -21,7 +21,7 @@ proxyquire('../send.container.js', { return () => ({}) }, }, - 'react-router-dom': { withRouter: () => {} }, + 'react-router-dom': { withRouter: () => undefined }, 'redux': { compose: (_, arg2) => () => arg2() }, '../../store/actions': actionSpies, '../../ducks/send/send.duck': duckActionSpies, diff --git a/ui/app/pages/settings/advanced-tab/tests/advanced-tab-component.test.js b/ui/app/pages/settings/advanced-tab/tests/advanced-tab-component.test.js index 69fe064c8..cd8e9a200 100644 --- a/ui/app/pages/settings/advanced-tab/tests/advanced-tab-component.test.js +++ b/ui/app/pages/settings/advanced-tab/tests/advanced-tab-component.test.js @@ -10,10 +10,10 @@ describe('AdvancedTab Component', function () { const root = shallow( {}} - setIpfsGateway={() => {}} - setShowFiatConversionOnTestnetsPreference={() => {}} - setThreeBoxSyncingPermission={() => {}} + setAutoLockTimeLimit={() => undefined} + setIpfsGateway={() => undefined} + setShowFiatConversionOnTestnetsPreference={() => undefined} + setThreeBoxSyncingPermission={() => undefined} threeBoxDisabled threeBoxSyncingAllowed={false} />, @@ -33,9 +33,9 @@ describe('AdvancedTab Component', function () { {}} - setShowFiatConversionOnTestnetsPreference={() => {}} - setThreeBoxSyncingPermission={() => {}} + setIpfsGateway={() => undefined} + setShowFiatConversionOnTestnetsPreference={() => undefined} + setThreeBoxSyncingPermission={() => undefined} threeBoxDisabled threeBoxSyncingAllowed={false} />, diff --git a/ui/app/pages/settings/security-tab/tests/security-tab.test.js b/ui/app/pages/settings/security-tab/tests/security-tab.test.js index 1ac996d05..d5720aa6a 100644 --- a/ui/app/pages/settings/security-tab/tests/security-tab.test.js +++ b/ui/app/pages/settings/security-tab/tests/security-tab.test.js @@ -28,7 +28,7 @@ describe('Security Tab', function () { , { context: { t: (str) => str, - metricsEvent: () => {}, + metricsEvent: () => undefined, }, }, )