2018-05-05 17:11:53 +02:00
|
|
|
import assert from 'assert'
|
|
|
|
import proxyquire from 'proxyquire'
|
|
|
|
|
|
|
|
let mapStateToProps
|
|
|
|
|
|
|
|
proxyquire('../account-list-item.container.js', {
|
|
|
|
'react-redux': {
|
2019-05-08 21:51:33 +02:00
|
|
|
connect: (ms) => {
|
2018-05-05 17:11:53 +02:00
|
|
|
mapStateToProps = ms
|
|
|
|
return () => ({})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'../send.selectors.js': {
|
2019-02-26 19:30:41 +01:00
|
|
|
getConversionRate: () => `mockConversionRate`,
|
|
|
|
getCurrentCurrency: () => `mockCurrentCurrency`,
|
|
|
|
getNativeCurrency: () => `mockNativeCurrency`,
|
2018-05-05 17:11:53 +02:00
|
|
|
},
|
2019-04-17 21:15:13 +02:00
|
|
|
'../../../selectors/selectors': {
|
2019-02-26 19:30:41 +01:00
|
|
|
isBalanceCached: () => `mockBalanceIsCached`,
|
|
|
|
preferencesSelector: ({ showFiatInTestnets }) => ({
|
|
|
|
showFiatInTestnets,
|
|
|
|
}),
|
|
|
|
getIsMainnet: ({ isMainnet }) => isMainnet,
|
2019-01-30 13:16:12 +01:00
|
|
|
},
|
2018-05-05 17:11:53 +02:00
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('account-list-item container', function () {
|
2018-05-05 17:11:53 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('mapStateToProps()', function () {
|
2018-05-05 17:11:53 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should map the correct properties to props', function () {
|
2019-02-26 19:30:41 +01:00
|
|
|
assert.deepEqual(mapStateToProps({ isMainnet: true, showFiatInTestnets: false }), {
|
|
|
|
nativeCurrency: 'mockNativeCurrency',
|
|
|
|
balanceIsCached: 'mockBalanceIsCached',
|
|
|
|
showFiat: true,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should map the correct properties to props when in mainnet and showFiatInTestnet is true', function () {
|
2019-02-26 19:30:41 +01:00
|
|
|
assert.deepEqual(mapStateToProps({ isMainnet: true, showFiatInTestnets: true }), {
|
|
|
|
nativeCurrency: 'mockNativeCurrency',
|
|
|
|
balanceIsCached: 'mockBalanceIsCached',
|
|
|
|
showFiat: true,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should map the correct properties to props when not in mainnet and showFiatInTestnet is true', function () {
|
2019-02-26 19:30:41 +01:00
|
|
|
assert.deepEqual(mapStateToProps({ isMainnet: false, showFiatInTestnets: true }), {
|
|
|
|
nativeCurrency: 'mockNativeCurrency',
|
|
|
|
balanceIsCached: 'mockBalanceIsCached',
|
|
|
|
showFiat: true,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should map the correct properties to props when not in mainnet and showFiatInTestnet is false', function () {
|
2019-02-26 19:30:41 +01:00
|
|
|
assert.deepEqual(mapStateToProps({ isMainnet: false, showFiatInTestnets: false }), {
|
|
|
|
nativeCurrency: 'mockNativeCurrency',
|
|
|
|
balanceIsCached: 'mockBalanceIsCached',
|
|
|
|
showFiat: false,
|
2018-05-05 17:11:53 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|