1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 11:46:13 +02:00
metamask-extension/ui/app/pages/send/account-list-item/tests/account-list-item-container.test.js
Whymarrh Whitby 4f3fc95d50
Update ESLint rules for test suite (#8023)
* Use @metamask/eslint-config@1.1.0
* Use eslint-plugin-mocha@6.2.2
* Mark root ESLint config as root
* Update Mocha ESLint rules with shared ESLint config
2020-02-11 13:21:13 -03:30

66 lines
2.0 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', function () {
describe('mapStateToProps()', function () {
it('should map the correct properties to props', function () {
assert.deepEqual(mapStateToProps({ isMainnet: true, showFiatInTestnets: false }), {
nativeCurrency: 'mockNativeCurrency',
balanceIsCached: 'mockBalanceIsCached',
showFiat: true,
})
})
it('should map the correct properties to props when in mainnet and showFiatInTestnet is true', function () {
assert.deepEqual(mapStateToProps({ isMainnet: true, showFiatInTestnets: true }), {
nativeCurrency: 'mockNativeCurrency',
balanceIsCached: 'mockBalanceIsCached',
showFiat: true,
})
})
it('should map the correct properties to props when not in mainnet and showFiatInTestnet is true', function () {
assert.deepEqual(mapStateToProps({ isMainnet: false, showFiatInTestnets: true }), {
nativeCurrency: 'mockNativeCurrency',
balanceIsCached: 'mockBalanceIsCached',
showFiat: true,
})
})
it('should map the correct properties to props when not in mainnet and showFiatInTestnet is false', function () {
assert.deepEqual(mapStateToProps({ isMainnet: false, showFiatInTestnets: false }), {
nativeCurrency: 'mockNativeCurrency',
balanceIsCached: 'mockBalanceIsCached',
showFiat: false,
})
})
})
})