|
|
|
@ -6,7 +6,6 @@ import { Provider } from 'react-redux'; |
|
|
|
|
import configureMockStore from 'redux-mock-store'; |
|
|
|
|
import UnitInput from '../../ui/unit-input'; |
|
|
|
|
import CurrencyDisplay from '../../ui/currency-display'; |
|
|
|
|
import { MAX_DECIMAL } from '../../../../shared/constants/decimal'; |
|
|
|
|
import CurrencyInput from './currency-input'; |
|
|
|
|
|
|
|
|
|
describe('CurrencyInput Component', () => { |
|
|
|
@ -146,11 +145,7 @@ describe('CurrencyInput Component', () => { |
|
|
|
|
|
|
|
|
|
const wrapper = mount( |
|
|
|
|
<Provider store={store}> |
|
|
|
|
<CurrencyInput |
|
|
|
|
hexValue="f602f2234d0ea" |
|
|
|
|
featureSecondary |
|
|
|
|
primaryNumberOfDecimals={MAX_DECIMAL} |
|
|
|
|
/> |
|
|
|
|
<CurrencyInput hexValue="f602f2234d0ea" featureSecondary /> |
|
|
|
|
</Provider>, |
|
|
|
|
{ |
|
|
|
|
context: { t: (str) => `${str}_t` }, |
|
|
|
@ -162,7 +157,7 @@ describe('CurrencyInput Component', () => { |
|
|
|
|
expect(wrapper.find('.unit-input__suffix')).toHaveLength(1); |
|
|
|
|
expect(wrapper.find('.unit-input__suffix').text()).toStrictEqual('ETH'); |
|
|
|
|
expect(wrapper.find('.unit-input__input').props().value).toStrictEqual( |
|
|
|
|
0.004327880204276, |
|
|
|
|
0.00432788, |
|
|
|
|
); |
|
|
|
|
expect( |
|
|
|
|
wrapper.find('.currency-input__conversion-component').text(), |
|
|
|
@ -198,11 +193,7 @@ describe('CurrencyInput Component', () => { |
|
|
|
|
const store = configureMockStore()(mockStore); |
|
|
|
|
const wrapper = mount( |
|
|
|
|
<Provider store={store}> |
|
|
|
|
<CurrencyInput |
|
|
|
|
onChange={handleChangeSpy} |
|
|
|
|
hexValue="f602f2234d0ea" |
|
|
|
|
primaryNumberOfDecimals={MAX_DECIMAL} |
|
|
|
|
/> |
|
|
|
|
<CurrencyInput onChange={handleChangeSpy} hexValue="f602f2234d0ea" /> |
|
|
|
|
</Provider>, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
@ -211,7 +202,7 @@ describe('CurrencyInput Component', () => { |
|
|
|
|
expect(handleBlurSpy.callCount).toStrictEqual(0); |
|
|
|
|
|
|
|
|
|
const input = wrapper.find('input'); |
|
|
|
|
expect(input.props().value).toStrictEqual(0.004327880204276); |
|
|
|
|
expect(input.props().value).toStrictEqual(0.00432788); |
|
|
|
|
|
|
|
|
|
input.simulate('change', { target: { value: 1 } }); |
|
|
|
|
expect(handleChangeSpy.callCount).toStrictEqual(2); |
|
|
|
|