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.
71 lines
1.8 KiB
71 lines
1.8 KiB
7 years ago
|
import assert from 'assert'
|
||
|
import proxyquire from 'proxyquire'
|
||
|
import sinon from 'sinon'
|
||
|
|
||
|
let mapStateToProps
|
||
|
let mapDispatchToProps
|
||
|
|
||
|
const actionSpies = {
|
||
|
showModal: sinon.spy(),
|
||
|
}
|
||
|
|
||
|
proxyquire('../send-gas-row.container.js', {
|
||
|
'react-redux': {
|
||
|
connect: (ms, md) => {
|
||
|
mapStateToProps = ms
|
||
|
mapDispatchToProps = md
|
||
|
return () => ({})
|
||
|
},
|
||
|
},
|
||
|
'../../send.selectors.js': {
|
||
|
getConversionRate: (s) => `mockConversionRate:${s}`,
|
||
7 years ago
|
getCurrentCurrency: (s) => `mockConvertedCurrency:${s}`,
|
||
7 years ago
|
getGasTotal: (s) => `mockGasTotal:${s}`,
|
||
|
},
|
||
7 years ago
|
'./send-gas-row.selectors.js': {
|
||
|
getGasLoadingError: (s) => `mockGasLoadingError:${s}`,
|
||
|
gasFeeIsInError: (s) => `mockGasFeeError:${s}`,
|
||
|
},
|
||
7 years ago
|
'../../../../actions': actionSpies,
|
||
|
})
|
||
|
|
||
|
describe('send-gas-row container', () => {
|
||
|
|
||
|
describe('mapStateToProps()', () => {
|
||
|
|
||
|
it('should map the correct properties to props', () => {
|
||
|
assert.deepEqual(mapStateToProps('mockState'), {
|
||
|
conversionRate: 'mockConversionRate:mockState',
|
||
|
convertedCurrency: 'mockConvertedCurrency:mockState',
|
||
|
gasTotal: 'mockGasTotal:mockState',
|
||
7 years ago
|
gasFeeError: 'mockGasFeeError:mockState',
|
||
7 years ago
|
gasLoadingError: 'mockGasLoadingError:mockState',
|
||
|
})
|
||
|
})
|
||
|
|
||
|
})
|
||
|
|
||
|
describe('mapDispatchToProps()', () => {
|
||
|
let dispatchSpy
|
||
|
let mapDispatchToPropsObject
|
||
|
|
||
|
beforeEach(() => {
|
||
|
dispatchSpy = sinon.spy()
|
||
|
mapDispatchToPropsObject = mapDispatchToProps(dispatchSpy)
|
||
|
})
|
||
|
|
||
|
describe('showCustomizeGasModal()', () => {
|
||
|
it('should dispatch an action', () => {
|
||
|
mapDispatchToPropsObject.showCustomizeGasModal()
|
||
|
assert(dispatchSpy.calledOnce)
|
||
|
assert.deepEqual(
|
||
|
actionSpies.showModal.getCall(0).args[0],
|
||
|
{ name: 'CUSTOMIZE_GAS' }
|
||
|
)
|
||
|
})
|
||
|
})
|
||
|
|
||
|
})
|
||
|
|
||
|
})
|