You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.4 KiB
74 lines
2.4 KiB
7 years ago
|
import assert from 'assert'
|
||
|
import proxyquire from 'proxyquire'
|
||
|
|
||
|
let mapStateToProps
|
||
|
|
||
|
proxyquire('../account-list-item.container.js', {
|
||
|
'react-redux': {
|
||
|
connect: (ms, md) => {
|
||
|
mapStateToProps = ms
|
||
|
return () => ({})
|
||
|
},
|
||
|
},
|
||
|
'../send.selectors.js': {
|
||
6 years ago
|
getConversionRate: () => `mockConversionRate`,
|
||
|
getCurrentCurrency: () => `mockCurrentCurrency`,
|
||
|
getNativeCurrency: () => `mockNativeCurrency`,
|
||
7 years ago
|
},
|
||
6 years ago
|
'../../../selectors/selectors': {
|
||
6 years ago
|
isBalanceCached: () => `mockBalanceIsCached`,
|
||
|
preferencesSelector: ({ showFiatInTestnets }) => ({
|
||
|
showFiatInTestnets,
|
||
|
}),
|
||
|
getIsMainnet: ({ isMainnet }) => isMainnet,
|
||
6 years ago
|
},
|
||
7 years ago
|
})
|
||
|
|
||
|
describe('account-list-item container', () => {
|
||
|
|
||
|
describe('mapStateToProps()', () => {
|
||
|
|
||
|
it('should map the correct properties to props', () => {
|
||
6 years ago
|
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,
|
||
7 years ago
|
})
|
||
|
})
|
||
|
|
||
|
})
|
||
|
|
||
|
})
|