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.
56 lines
1.6 KiB
56 lines
1.6 KiB
7 years ago
|
import React from 'react'
|
||
|
import assert from 'assert'
|
||
|
import {shallow} from 'enzyme'
|
||
|
import GasFeeDisplay from '../gas-fee-display.component'
|
||
|
import CurrencyDisplay from '../../../../../send/currency-display'
|
||
7 years ago
|
import sinon from 'sinon'
|
||
7 years ago
|
|
||
|
|
||
|
const propsMethodSpies = {
|
||
|
showCustomizeGasModal: sinon.spy(),
|
||
|
}
|
||
|
|
||
7 years ago
|
describe('SendGasRow Component', function () {
|
||
7 years ago
|
let wrapper
|
||
|
|
||
|
beforeEach(() => {
|
||
|
wrapper = shallow(<GasFeeDisplay
|
||
|
conversionRate={20}
|
||
|
gasTotal={'mockGasTotal'}
|
||
|
onClick={propsMethodSpies.showCustomizeGasModal}
|
||
|
primaryCurrency={'mockPrimaryCurrency'}
|
||
|
convertedCurrency={'mockConvertedCurrency'}
|
||
|
/>, {context: {t: str => str + '_t'}})
|
||
|
})
|
||
|
|
||
|
afterEach(() => {
|
||
|
propsMethodSpies.showCustomizeGasModal.resetHistory()
|
||
|
})
|
||
|
|
||
|
describe('render', () => {
|
||
|
it('should render a CurrencyDisplay component', () => {
|
||
|
assert.equal(wrapper.find(CurrencyDisplay).length, 1)
|
||
|
})
|
||
|
|
||
|
it('should render the CurrencyDisplay with the correct props', () => {
|
||
|
const {
|
||
|
conversionRate,
|
||
|
convertedCurrency,
|
||
7 years ago
|
value,
|
||
7 years ago
|
} = wrapper.find(CurrencyDisplay).props()
|
||
|
assert.equal(conversionRate, 20)
|
||
|
assert.equal(convertedCurrency, 'mockConvertedCurrency')
|
||
|
assert.equal(value, 'mockGasTotal')
|
||
|
})
|
||
|
|
||
|
it('should render the Button with the correct props', () => {
|
||
|
const {
|
||
|
onClick,
|
||
7 years ago
|
} = wrapper.find('button').props()
|
||
7 years ago
|
assert.equal(propsMethodSpies.showCustomizeGasModal.callCount, 0)
|
||
|
onClick()
|
||
|
assert.equal(propsMethodSpies.showCustomizeGasModal.callCount, 1)
|
||
|
})
|
||
|
})
|
||
|
})
|