1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 11:01:41 +01:00
metamask-extension/ui/app/pages/send/account-list-item/tests/account-list-item-container.test.js
Whymarrh Whitby 094e4cf555 Check for unused function arguments (#6583)
* eslint: Check for unused function arguments

* eslint: Ignore unused '_' in argument list

Also allow any number of '_' e.g., '__' or '___' which is to be used sparingly

* Remove and rename unused arguments
2019-05-08 15:51:33 -04:00

74 lines
2.4 KiB
JavaScript

import assert from 'assert'
import proxyquire from 'proxyquire'
let mapStateToProps
proxyquire('../account-list-item.container.js', {
'react-redux': {
connect: (ms) => {
mapStateToProps = ms
return () => ({})
},
},
'../send.selectors.js': {
getConversionRate: () => `mockConversionRate`,
getCurrentCurrency: () => `mockCurrentCurrency`,
getNativeCurrency: () => `mockNativeCurrency`,
},
'../../../selectors/selectors': {
isBalanceCached: () => `mockBalanceIsCached`,
preferencesSelector: ({ showFiatInTestnets }) => ({
showFiatInTestnets,
}),
getIsMainnet: ({ isMainnet }) => isMainnet,
},
})
describe('account-list-item container', () => {
describe('mapStateToProps()', () => {
it('should map the correct properties to props', () => {
assert.deepEqual(mapStateToProps({ isMainnet: true, showFiatInTestnets: false }), {
conversionRate: 'mockConversionRate',
currentCurrency: 'mockCurrentCurrency',
nativeCurrency: 'mockNativeCurrency',
balanceIsCached: 'mockBalanceIsCached',
showFiat: true,
})
})
it('should map the correct properties to props when in mainnet and showFiatInTestnet is true', () => {
assert.deepEqual(mapStateToProps({ isMainnet: true, showFiatInTestnets: true }), {
conversionRate: 'mockConversionRate',
currentCurrency: 'mockCurrentCurrency',
nativeCurrency: 'mockNativeCurrency',
balanceIsCached: 'mockBalanceIsCached',
showFiat: true,
})
})
it('should map the correct properties to props when not in mainnet and showFiatInTestnet is true', () => {
assert.deepEqual(mapStateToProps({ isMainnet: false, showFiatInTestnets: true }), {
conversionRate: 'mockConversionRate',
currentCurrency: 'mockCurrentCurrency',
nativeCurrency: 'mockNativeCurrency',
balanceIsCached: 'mockBalanceIsCached',
showFiat: true,
})
})
it('should map the correct properties to props when not in mainnet and showFiatInTestnet is false', () => {
assert.deepEqual(mapStateToProps({ isMainnet: false, showFiatInTestnets: false }), {
conversionRate: 'mockConversionRate',
currentCurrency: 'mockCurrentCurrency',
nativeCurrency: 'mockNativeCurrency',
balanceIsCached: 'mockBalanceIsCached',
showFiat: false,
})
})
})
})