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