1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

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.
This commit is contained in:
Whymarrh Whitby 2020-08-14 09:17:02 -02:30 committed by GitHub
parent 9b78d3ab07
commit c11888f287
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 79 additions and 84 deletions

View File

@ -53,6 +53,7 @@ module.exports = {
'no-constant-condition': 'error', 'no-constant-condition': 'error',
'no-dupe-else-if': 'error', 'no-dupe-else-if': 'error',
'no-empty': 'error', 'no-empty': 'error',
'no-empty-function': 'error',
'no-eq-null': 'error', 'no-eq-null': 'error',
'no-global-assign': 'error', 'no-global-assign': 'error',
'no-loop-func': 'error', 'no-loop-func': 'error',

View File

@ -19,7 +19,7 @@ export default class AppStateController extends EventEmitter {
super() super()
this.onInactiveTimeout = onInactiveTimeout || (() => {}) this.onInactiveTimeout = onInactiveTimeout || (() => undefined)
this.store = new ObservableStore(Object.assign({ this.store = new ObservableStore(Object.assign({
timeoutMinutes: 0, timeoutMinutes: 0,
connectedStatusPopoverHasBeenShown: true, connectedStatusPopoverHasBeenShown: true,

View File

@ -132,7 +132,7 @@ export class PermissionsController {
const req = { method: 'eth_accounts' } const req = { method: 'eth_accounts' }
const res = {} const res = {}
this.permissions.providerMiddlewareFunction( this.permissions.providerMiddlewareFunction(
{ origin }, req, res, () => {}, _end, { origin }, req, res, () => undefined, _end,
) )
function _end () { function _end () {
@ -187,7 +187,7 @@ export class PermissionsController {
const res = {} const res = {}
this.permissions.providerMiddlewareFunction( this.permissions.providerMiddlewareFunction(
domain, req, res, () => {}, _end, domain, req, res, () => undefined, _end,
) )
function _end (_err) { function _end (_err) {

View File

@ -50,7 +50,7 @@ class Mock3Box {
}, },
} }
}, },
logout: () => {}, logout: () => undefined,
}) })
} }

View File

@ -80,7 +80,7 @@ require('abortcontroller-polyfill/dist/polyfill-patch-fetch')
window.localStorage = {} window.localStorage = {}
// override metamask-logo // override metamask-logo
window.requestAnimationFrame = () => {} window.requestAnimationFrame = () => undefined
// crypto.getRandomValues // crypto.getRandomValues
if (!window.crypto) { if (!window.crypto) {

View File

@ -27,7 +27,7 @@ export function mountWithRouter (component, store = {}, pathname = '/') {
context: { context: {
router, router,
t: (str) => str, t: (str) => str,
metricsEvent: () => {}, metricsEvent: () => undefined,
store, store,
}, },
childContextTypes: { childContextTypes: {

View File

@ -25,7 +25,7 @@ describe('Promise global is immutable', function () {
it('throws when mutating existing Promise property', function () { it('throws when mutating existing Promise property', function () {
try { try {
Promise.all = () => {} Promise.all = () => undefined
assert.fail('did not throw error') assert.fail('did not throw error')
} catch (err) { } catch (err) {
assert.ok(err, 'did throw error') assert.ok(err, 'did throw error')

View File

@ -9,7 +9,7 @@ describe('CachedBalancesController', function () {
getNetwork: () => Promise.resolve(17), getNetwork: () => Promise.resolve(17),
accountTracker: { accountTracker: {
store: { store: {
subscribe: () => {}, subscribe: () => undefined,
}, },
}, },
initState: { initState: {
@ -32,7 +32,7 @@ describe('CachedBalancesController', function () {
const controller = new CachedBalancesController({ const controller = new CachedBalancesController({
accountTracker: { accountTracker: {
store: { store: {
subscribe: () => {}, subscribe: () => undefined,
}, },
}, },
initState: { initState: {
@ -75,7 +75,7 @@ describe('CachedBalancesController', function () {
const controller = new CachedBalancesController({ const controller = new CachedBalancesController({
accountTracker: { accountTracker: {
store: { store: {
subscribe: () => {}, subscribe: () => undefined,
}, },
}, },
initState: { initState: {

View File

@ -14,7 +14,7 @@ describe('DetectTokensController', function () {
const sandbox = sinon.createSandbox() const sandbox = sinon.createSandbox()
let keyringMemStore, network, preferences let keyringMemStore, network, preferences
const noop = () => {} const noop = () => undefined
const networkControllerProviderConfig = { const networkControllerProviderConfig = {
getAccounts: noop, getAccounts: noop,

View File

@ -19,7 +19,7 @@ import proxyquire from 'proxyquire'
class ThreeBoxControllerMock { class ThreeBoxControllerMock {
constructor () { constructor () {
this.store = { this.store = {
subscribe: () => {}, subscribe: () => undefined,
getState: () => ({}), getState: () => ({}),
} }
this.init = threeBoxSpies.init this.init = threeBoxSpies.init
@ -78,7 +78,7 @@ const CUSTOM_RPC_URL = 'http://localhost:8545'
describe('MetaMaskController', function () { describe('MetaMaskController', function () {
let metamaskController let metamaskController
const sandbox = sinon.createSandbox() const sandbox = sinon.createSandbox()
const noop = () => {} const noop = () => undefined
beforeEach(function () { beforeEach(function () {
@ -113,7 +113,7 @@ describe('MetaMaskController', function () {
}, },
}, },
initState: cloneDeep(firstTimeState), initState: cloneDeep(firstTimeState),
platform: { showTransactionNotification: () => {} }, platform: { showTransactionNotification: () => undefined },
}) })
// disable diagnostics // disable diagnostics
metamaskController.diagnostics = null metamaskController.diagnostics = null

View File

@ -6,7 +6,7 @@ import { getNetworkDisplayName } from '../../../../../app/scripts/controllers/ne
describe('NetworkController', function () { describe('NetworkController', function () {
describe('controller', function () { describe('controller', function () {
let networkController let networkController
const noop = () => {} const noop = () => undefined
const networkControllerProviderConfig = { const networkControllerProviderConfig = {
getAccounts: noop, getAccounts: noop,
} }

View File

@ -20,7 +20,7 @@ import {
* - Immutable mock values like Ethereum accounts and expected states * - Immutable mock values like Ethereum accounts and expected states
*/ */
export const noop = () => {} export const noop = () => undefined
/** /**
* Mock Permissions Controller and Middleware * Mock Permissions Controller and Middleware

View File

@ -372,7 +372,7 @@ describe('preferences controller', function () {
beforeEach(function () { beforeEach(function () {
req = { params: {} } req = { params: {} }
res = {} res = {}
asy = { next: () => {}, end: () => {} } asy = { next: () => undefined, end: () => undefined }
stubNext = sandbox.stub(asy, 'next') stubNext = sandbox.stub(asy, 'next')
stubEnd = sandbox.stub(asy, 'end').returns(0) stubEnd = sandbox.stub(asy, 'end').returns(0)
stubHandleWatchAssetERC20 = sandbox.stub(preferencesController, '_handleWatchAssetERC20') stubHandleWatchAssetERC20 = sandbox.stub(preferencesController, '_handleWatchAssetERC20')
@ -382,7 +382,7 @@ describe('preferences controller', function () {
}) })
it('shouldn not do anything if method not corresponds', async 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 stubNext = sandbox.stub(asy, 'next')
const stubEnd = sandbox.stub(asy, 'end').returns(0) const stubEnd = sandbox.stub(asy, 'end').returns(0)
req.method = 'metamask' req.method = 'metamask'
@ -391,7 +391,7 @@ describe('preferences controller', function () {
sandbox.assert.called(stubNext) sandbox.assert.called(stubNext)
}) })
it('should do something if method is supported', async function () { 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 stubNext = sandbox.stub(asy, 'next')
const stubEnd = sandbox.stub(asy, 'end').returns(0) const stubEnd = sandbox.stub(asy, 'end').returns(0)
req.method = 'metamask_watchAsset' req.method = 'metamask_watchAsset'
@ -415,7 +415,7 @@ describe('preferences controller', function () {
assert.deepEqual(res, {}) assert.deepEqual(res, {})
}) })
it('should trigger handle add asset if type supported', async function () { 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.method = 'metamask_watchAsset'
req.params.type = 'ERC20' req.params.type = 'ERC20'
await preferencesController.requestWatchAsset(req, res, asy.next, asy.end) await preferencesController.requestWatchAsset(req, res, asy.next, asy.end)
@ -442,7 +442,7 @@ describe('preferences controller', function () {
req.params.options = { address, symbol, decimals, image } req.params.options = { address, symbol, decimals, image }
sandbox.stub(preferencesController, '_validateERC20AssetParams').returns(true) sandbox.stub(preferencesController, '_validateERC20AssetParams').returns(true)
preferencesController.openPopup = async () => {} preferencesController.openPopup = async () => undefined
await preferencesController._handleWatchAssetERC20(req.params.options) await preferencesController._handleWatchAssetERC20(req.params.options)
const suggested = preferencesController.getSuggestedTokens() const suggested = preferencesController.getSuggestedTokens()

View File

@ -147,15 +147,15 @@ describe('PendingTransactionTracker', function () {
}, },
nonceTracker: { nonceTracker: {
getGlobalLock: async () => { getGlobalLock: async () => {
return { releaseLock: () => {} } return { releaseLock: () => undefined }
}, },
}, },
getPendingTransactions: () => txList, getPendingTransactions: () => txList,
getCompletedTransactions: () => { getCompletedTransactions: () => {
return [] return []
}, },
publishTransaction: () => {}, publishTransaction: () => undefined,
confirmTransaction: () => {}, confirmTransaction: () => undefined,
}) })
const checkPendingTxStub = sinon.stub(pendingTxTracker, '_checkPendingTx').resolves() const checkPendingTxStub = sinon.stub(pendingTxTracker, '_checkPendingTx').resolves()

View File

@ -47,7 +47,7 @@ describe('Transaction Controller', function () {
ethTx.sign(fromAccount.key) ethTx.sign(fromAccount.key)
resolve() resolve()
}), }),
getPermittedAccounts: () => {}, getPermittedAccounts: () => undefined,
}) })
txController.nonceTracker.getNonceLock = () => Promise.resolve({ nextNonce: 0, releaseLock: noop }) txController.nonceTracker.getNonceLock = () => Promise.resolve({ nextNonce: 0, releaseLock: noop })
}) })

View File

@ -9,7 +9,7 @@ describe('txUtils', function () {
before(function () { before(function () {
txUtils = new TxUtils(new Proxy({}, { txUtils = new TxUtils(new Proxy({}, {
get: () => { get: () => {
return () => {} return () => undefined
}, },
})) }))
}) })

View File

@ -14,9 +14,6 @@ describe('Message Manager', function () {
assert.ok(Array.isArray(result)) assert.ok(Array.isArray(result))
assert.equal(result.length, 0) assert.equal(result.length, 0)
}) })
it('should also return transactions from local storage if any', function () {
})
}) })
describe('#addMsg', function () { describe('#addMsg', function () {

View File

@ -14,9 +14,6 @@ describe('Personal Message Manager', function () {
assert.ok(Array.isArray(result)) assert.ok(Array.isArray(result))
assert.equal(result.length, 0) assert.equal(result.length, 0)
}) })
it('should also return transactions from local storage if any', function () {
})
}) })
describe('#addMsg', function () { describe('#addMsg', function () {

View File

@ -19,7 +19,7 @@ const mockStore = (state = defaultState) => configureStore(middleware)(state)
describe('Actions', function () { describe('Actions', function () {
const noop = () => {} const noop = () => undefined
const currentNetworkId = '42' const currentNetworkId = '42'

View File

@ -30,7 +30,7 @@ describe('App Header', function () {
<AppHeader.WrappedComponent {...props} />, { <AppHeader.WrappedComponent {...props} />, {
context: { context: {
t: (str) => str, t: (str) => str,
metricsEvent: () => {}, metricsEvent: () => undefined,
}, },
}, },
) )
@ -54,8 +54,8 @@ describe('App Header', function () {
const network = wrapper.find({ network: 'test' }) const network = wrapper.find({ network: 'test' })
network.simulate('click', { network.simulate('click', {
preventDefault: () => {}, preventDefault: () => undefined,
stopPropagation: () => {}, stopPropagation: () => undefined,
}) })
assert(props.showNetworkDropdown.calledOnce) assert(props.showNetworkDropdown.calledOnce)
@ -66,8 +66,8 @@ describe('App Header', function () {
const network = wrapper.find({ network: 'test' }) const network = wrapper.find({ network: 'test' })
network.simulate('click', { network.simulate('click', {
preventDefault: () => {}, preventDefault: () => undefined,
stopPropagation: () => {}, stopPropagation: () => undefined,
}) })
assert(props.hideNetworkDropdown.calledOnce) assert(props.hideNetworkDropdown.calledOnce)

View File

@ -48,10 +48,10 @@ describe('Modal Component', function () {
it('should render a modal with different button types', function () { it('should render a modal with different button types', function () {
const wrapper = shallow( const wrapper = shallow(
<Modal <Modal
onCancel={() => {}} onCancel={() => undefined}
cancelText="Cancel" cancelText="Cancel"
cancelType="secondary" cancelType="secondary"
onSubmit={() => {}} onSubmit={() => undefined}
submitText="Submit" submitText="Submit"
submitType="confirm" submitType="confirm"
/>, />,
@ -66,9 +66,9 @@ describe('Modal Component', function () {
it('should render a modal with children', function () { it('should render a modal with children', function () {
const wrapper = shallow( const wrapper = shallow(
<Modal <Modal
onCancel={() => {}} onCancel={() => undefined}
cancelText="Cancel" cancelText="Cancel"
onSubmit={() => {}} onSubmit={() => undefined}
submitText="Submit" submitText="Submit"
> >
<div className="test-child" /> <div className="test-child" />

View File

@ -34,7 +34,7 @@ describe('CancelTransaction Component', function () {
defaultNewGasPrice="0x3b9aca00" defaultNewGasPrice="0x3b9aca00"
createCancelTransaction={createCancelTransactionSpy} createCancelTransaction={createCancelTransactionSpy}
hideModal={hideModalSpy} hideModal={hideModalSpy}
showTransactionConfirmedModal={() => {}} showTransactionConfirmedModal={() => undefined}
/>, />,
{ context: { t } }, { context: { t } },
) )

View File

@ -134,8 +134,8 @@ class FadeModal extends Component {
} }
static defaultProps = { static defaultProps = {
onShow: function () {}, onShow: () => undefined,
onHide: function () {}, onHide: () => undefined,
keyboard: true, keyboard: true,
backdrop: true, backdrop: true,
closeOnClick: true, closeOnClick: true,

View File

@ -17,7 +17,7 @@ describe('MetaMetrics Opt In', function () {
wrapper = mount( wrapper = mount(
<MetaMetricsOptIn.WrappedComponent {...props} />, { <MetaMetricsOptIn.WrappedComponent {...props} />, {
context: { context: {
metricsEvent: () => {}, metricsEvent: () => undefined,
}, },
}, },
) )

View File

@ -9,7 +9,7 @@ describe('SelectedAccount Component', function () {
<SelectedAccount <SelectedAccount
selectedIdentity={{ name: 'testName', address: '0x1b82543566f41a7db9a9a75fc933c340ffb55c9d' }} selectedIdentity={{ name: 'testName', address: '0x1b82543566f41a7db9a9a75fc933c340ffb55c9d' }}
/> />
), { context: { t: () => {} } }) ), { context: { t: () => undefined } })
// Checksummed version of address is displayed // Checksummed version of address is displayed
assert.equal(wrapper.find('.selected-account__address').text(), '0x1B82...5C9D') assert.equal(wrapper.find('.selected-account__address').text(), '0x1B82...5C9D')
assert.equal(wrapper.find('.selected-account__name').text(), 'testName') assert.equal(wrapper.find('.selected-account__name').text(), 'testName')

View File

@ -10,9 +10,9 @@ describe('Signature Request Component', function () {
it('should render a div with one child', function () { it('should render a div with one child', function () {
const wrapper = shallow(( const wrapper = shallow((
<SignatureRequest <SignatureRequest
clearConfirmTransaction={() => {}} clearConfirmTransaction={() => undefined}
cancel={() => {}} cancel={() => undefined}
sign={() => {}} sign={() => undefined}
txData={{ txData={{
msgParams: { msgParams: {
data: '{"message": {"from": {"name": "hello"}}}', data: '{"message": {"from": {"name": "hello"}}}',

View File

@ -40,8 +40,8 @@ describe('TransactionActivityLog Component', function () {
inlineRetryIndex={-1} inlineRetryIndex={-1}
inlineCancelIndex={-1} inlineCancelIndex={-1}
nativeCurrency="ETH" nativeCurrency="ETH"
onCancel={() => {}} onCancel={() => undefined}
onRetry={() => {}} onRetry={() => undefined}
primaryTransactionStatus="confirmed" primaryTransactionStatus="confirmed"
/>, />,
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }, { context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
@ -87,8 +87,8 @@ describe('TransactionActivityLog Component', function () {
inlineRetryIndex={2} inlineRetryIndex={2}
inlineCancelIndex={3} inlineCancelIndex={3}
nativeCurrency="ETH" nativeCurrency="ETH"
onCancel={() => {}} onCancel={() => undefined}
onRetry={() => {}} onRetry={() => undefined}
primaryTransactionStatus="pending" primaryTransactionStatus="pending"
isEarliestNonce isEarliestNonce
/>, />,
@ -136,8 +136,8 @@ describe('TransactionActivityLog Component', function () {
inlineRetryIndex={2} inlineRetryIndex={2}
inlineCancelIndex={3} inlineCancelIndex={3}
nativeCurrency="ETH" nativeCurrency="ETH"
onCancel={() => {}} onCancel={() => undefined}
onRetry={() => {}} onRetry={() => undefined}
primaryTransactionStatus="pending" primaryTransactionStatus="pending"
isEarliestNonce={false} isEarliestNonce={false}
/>, />,

View File

@ -27,7 +27,7 @@ describe('TransactionBreakdownRow Component', function () {
title="test" title="test"
className="test-class" className="test-class"
> >
<Button onClick={() => {}} >Button</Button> <Button onClick={() => undefined} >Button</Button>
</TransactionBreakdownRow>, </TransactionBreakdownRow>,
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }, { context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
) )

View File

@ -34,7 +34,7 @@ describe('TransactionListItemDetails Component', function () {
title="Test Transaction Details" title="Test Transaction Details"
recipientAddress="0x1" recipientAddress="0x1"
senderAddress="0x2" senderAddress="0x2"
tryReverseResolveAddress={() => {}} tryReverseResolveAddress={() => undefined}
transactionGroup={transactionGroup} transactionGroup={transactionGroup}
senderNickname="sender-nickname" senderNickname="sender-nickname"
recipientNickname="recipient-nickname" recipientNickname="recipient-nickname"
@ -77,7 +77,7 @@ describe('TransactionListItemDetails Component', function () {
<TransactionListItemDetails <TransactionListItemDetails
recipientAddress="0x1" recipientAddress="0x1"
senderAddress="0x2" senderAddress="0x2"
tryReverseResolveAddress={() => {}} tryReverseResolveAddress={() => undefined}
transactionGroup={transactionGroup} transactionGroup={transactionGroup}
showSpeedUp showSpeedUp
senderNickname="sender-nickname" senderNickname="sender-nickname"
@ -117,7 +117,7 @@ describe('TransactionListItemDetails Component', function () {
<TransactionListItemDetails <TransactionListItemDetails
recipientAddress="0x1" recipientAddress="0x1"
senderAddress="0x2" senderAddress="0x2"
tryReverseResolveAddress={() => {}} tryReverseResolveAddress={() => undefined}
transactionGroup={transactionGroup} transactionGroup={transactionGroup}
senderNickname="sender-nickname" senderNickname="sender-nickname"
recipientNickname="recipient-nickname" recipientNickname="recipient-nickname"
@ -159,7 +159,7 @@ describe('TransactionListItemDetails Component', function () {
<TransactionListItemDetails <TransactionListItemDetails
recipientAddress="0x1" recipientAddress="0x1"
senderAddress="0x2" senderAddress="0x2"
tryReverseResolveAddress={() => {}} tryReverseResolveAddress={() => undefined}
transactionGroup={transactionGroup} transactionGroup={transactionGroup}
senderNickname="sender-nickname" senderNickname="sender-nickname"
recipientNickname="recipient-nickname" recipientNickname="recipient-nickname"

View File

@ -46,7 +46,7 @@ describe('useCancelTransaction', function () {
it(`should return a function that kicks off cancellation for id ${transactionId}`, function () { it(`should return a function that kicks off cancellation for id ${transactionId}`, function () {
const { result } = renderHook(() => useCancelTransaction(transactionGroup)) const { result } = renderHook(() => useCancelTransaction(transactionGroup))
assert.equal(typeof result.current[1], 'function') assert.equal(typeof result.current[1], 'function')
result.current[1]({ preventDefault: () => {}, stopPropagation: () => {} }) result.current[1]({ preventDefault: () => undefined, stopPropagation: () => undefined })
assert.equal( assert.equal(
dispatch.calledWith( dispatch.calledWith(
showModal({ showModal({
@ -90,7 +90,7 @@ describe('useCancelTransaction', function () {
it(`should return a function that kicks off cancellation for id ${transactionId}`, function () { it(`should return a function that kicks off cancellation for id ${transactionId}`, function () {
const { result } = renderHook(() => useCancelTransaction(transactionGroup)) const { result } = renderHook(() => useCancelTransaction(transactionGroup))
assert.equal(typeof result.current[1], 'function') assert.equal(typeof result.current[1], 'function')
result.current[1]({ preventDefault: () => {}, stopPropagation: () => {} }) result.current[1]({ preventDefault: () => undefined, stopPropagation: () => undefined })
assert.equal( assert.equal(
dispatch.calledWith( dispatch.calledWith(
showModal({ showModal({

View File

@ -12,7 +12,7 @@ describe('useRetryTransaction', function () {
describe('when transaction meets retry enabled criteria', function () { describe('when transaction meets retry enabled criteria', function () {
const dispatch = sinon.spy(() => Promise.resolve({ blockTime: 0 })) const dispatch = sinon.spy(() => Promise.resolve({ blockTime: 0 }))
const trackEvent = sinon.spy() const trackEvent = sinon.spy()
const event = { preventDefault: () => {}, stopPropagation: () => {} } const event = { preventDefault: () => undefined, stopPropagation: () => undefined }
before(function () { before(function () {
sinon.stub(reactRedux, 'useDispatch').returns(dispatch) sinon.stub(reactRedux, 'useDispatch').returns(dispatch)

View File

@ -19,7 +19,7 @@ describe('Add Token', function () {
const props = { const props = {
history: { history: {
push: sinon.stub().callsFake(() => {}), push: sinon.stub().callsFake(() => undefined),
}, },
setPendingTokens: sinon.spy(), setPendingTokens: sinon.spy(),
clearPendingTokens: sinon.spy(), clearPendingTokens: sinon.spy(),

View File

@ -23,7 +23,7 @@ describe('Reveal Seed Phrase', function () {
<RevealSeedPhrase.WrappedComponent {...props} />, { <RevealSeedPhrase.WrappedComponent {...props} />, {
context: { context: {
t: (str) => str, t: (str) => str,
metricsEvent: () => {}, metricsEvent: () => undefined,
}, },
}, },
) )

View File

@ -13,7 +13,7 @@ describe('AmountMaxButton Component', function () {
setMaxModeTo: sinon.spy(), setMaxModeTo: sinon.spy(),
} }
const MOCK_EVENT = { preventDefault: () => {} } const MOCK_EVENT = { preventDefault: () => undefined }
before(function () { before(function () {
sinon.spy(AmountMaxButton.prototype, 'setMaxAmount') sinon.spy(AmountMaxButton.prototype, 'setMaxAmount')
@ -33,7 +33,7 @@ describe('AmountMaxButton Component', function () {
), { ), {
context: { context: {
t: (str) => str + '_t', t: (str) => str + '_t',
metricsEvent: () => {}, metricsEvent: () => undefined,
}, },
}) })
instance = wrapper.instance() instance = wrapper.instance()

View File

@ -158,7 +158,7 @@ function shallowRenderSendAmountRow () {
updateGasFeeError={updateGasFeeError} updateGasFeeError={updateGasFeeError}
updateSendAmount={updateSendAmount} updateSendAmount={updateSendAmount}
updateSendAmountError={updateSendAmountError} updateSendAmountError={updateSendAmountError}
updateGas={() => {}} updateGas={() => undefined}
/> />
), { context: { t: (str) => str + '_t' } }) ), { context: { t: (str) => str + '_t' } })
const instance = wrapper.instance() const instance = wrapper.instance()

View File

@ -18,7 +18,7 @@ describe('SendFooter Component', function () {
const historySpies = { const historySpies = {
push: sinon.spy(), push: sinon.spy(),
} }
const MOCK_EVENT = { preventDefault: () => {} } const MOCK_EVENT = { preventDefault: () => undefined }
before(function () { before(function () {
sinon.spy(SendFooter.prototype, 'onCancel') sinon.spy(SendFooter.prototype, 'onCancel')

View File

@ -63,12 +63,12 @@ describe('Send Component', function () {
tokenBalance="mockTokenBalance" tokenBalance="mockTokenBalance"
tokenContract={{ method: 'mockTokenMethod' }} tokenContract={{ method: 'mockTokenMethod' }}
updateAndSetGasLimit={propsMethodSpies.updateAndSetGasLimit} updateAndSetGasLimit={propsMethodSpies.updateAndSetGasLimit}
qrCodeDetected={() => {}} qrCodeDetected={() => undefined}
scanQrCode={() => {}} scanQrCode={() => undefined}
updateSendEnsResolution={() => {}} updateSendEnsResolution={() => undefined}
updateSendEnsResolutionError={() => {}} updateSendEnsResolutionError={() => undefined}
updateSendErrors={propsMethodSpies.updateSendErrors} updateSendErrors={propsMethodSpies.updateSendErrors}
updateSendTo={() => {}} updateSendTo={() => undefined}
updateSendTokenBalance={propsMethodSpies.updateSendTokenBalance} updateSendTokenBalance={propsMethodSpies.updateSendTokenBalance}
resetSendState={propsMethodSpies.resetSendState} resetSendState={propsMethodSpies.resetSendState}
updateToNicknameIfNecessary={propsMethodSpies.updateToNicknameIfNecessary} updateToNicknameIfNecessary={propsMethodSpies.updateToNicknameIfNecessary}

View File

@ -21,7 +21,7 @@ proxyquire('../send.container.js', {
return () => ({}) return () => ({})
}, },
}, },
'react-router-dom': { withRouter: () => {} }, 'react-router-dom': { withRouter: () => undefined },
'redux': { compose: (_, arg2) => () => arg2() }, 'redux': { compose: (_, arg2) => () => arg2() },
'../../store/actions': actionSpies, '../../store/actions': actionSpies,
'../../ducks/send/send.duck': duckActionSpies, '../../ducks/send/send.duck': duckActionSpies,

View File

@ -10,10 +10,10 @@ describe('AdvancedTab Component', function () {
const root = shallow( const root = shallow(
<AdvancedTab <AdvancedTab
ipfsGateway="" ipfsGateway=""
setAutoLockTimeLimit={() => {}} setAutoLockTimeLimit={() => undefined}
setIpfsGateway={() => {}} setIpfsGateway={() => undefined}
setShowFiatConversionOnTestnetsPreference={() => {}} setShowFiatConversionOnTestnetsPreference={() => undefined}
setThreeBoxSyncingPermission={() => {}} setThreeBoxSyncingPermission={() => undefined}
threeBoxDisabled threeBoxDisabled
threeBoxSyncingAllowed={false} threeBoxSyncingAllowed={false}
/>, />,
@ -33,9 +33,9 @@ describe('AdvancedTab Component', function () {
<AdvancedTab <AdvancedTab
ipfsGateway="" ipfsGateway=""
setAutoLockTimeLimit={setAutoLockTimeLimitSpy} setAutoLockTimeLimit={setAutoLockTimeLimitSpy}
setIpfsGateway={() => {}} setIpfsGateway={() => undefined}
setShowFiatConversionOnTestnetsPreference={() => {}} setShowFiatConversionOnTestnetsPreference={() => undefined}
setThreeBoxSyncingPermission={() => {}} setThreeBoxSyncingPermission={() => undefined}
threeBoxDisabled threeBoxDisabled
threeBoxSyncingAllowed={false} threeBoxSyncingAllowed={false}
/>, />,

View File

@ -28,7 +28,7 @@ describe('Security Tab', function () {
<SecurityTab.WrappedComponent {...props} />, { <SecurityTab.WrappedComponent {...props} />, {
context: { context: {
t: (str) => str, t: (str) => str,
metricsEvent: () => {}, metricsEvent: () => undefined,
}, },
}, },
) )