2021-02-04 19:15:23 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
2021-03-16 22:00:08 +01:00
|
|
|
import TokenInput from '../../ui/token-input';
|
|
|
|
import UserPreferencedTokenInput from './user-preferenced-token-input.component';
|
2018-10-17 01:03:29 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('UserPreferencedCurrencyInput Component', () => {
|
|
|
|
describe('rendering', () => {
|
|
|
|
it('should render properly', () => {
|
2018-10-17 01:03:29 +02:00
|
|
|
const wrapper = shallow(
|
2020-07-14 17:20:41 +02:00
|
|
|
<UserPreferencedTokenInput token={{ address: '0x0' }} />,
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-17 01:03:29 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(wrapper).toHaveLength(1);
|
|
|
|
expect(wrapper.find(TokenInput)).toHaveLength(1);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2018-10-17 01:03:29 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
it('should render showFiat for TokenInput based on preferences.useNativeCurrencyAsPrimaryCurrency', () => {
|
2018-10-17 01:03:29 +02:00
|
|
|
const wrapper = shallow(
|
|
|
|
<UserPreferencedTokenInput
|
2020-05-29 00:08:11 +02:00
|
|
|
token={{ address: '0x0' }}
|
2018-10-26 10:26:43 +02:00
|
|
|
useNativeCurrencyAsPrimaryCurrency
|
2020-07-14 17:20:41 +02:00
|
|
|
/>,
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-17 01:03:29 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(wrapper).toHaveLength(1);
|
|
|
|
expect(wrapper.find(TokenInput)).toHaveLength(1);
|
|
|
|
expect(wrapper.find(TokenInput).props().showFiat).toStrictEqual(false);
|
2021-02-04 19:15:23 +01:00
|
|
|
wrapper.setProps({ useNativeCurrencyAsPrimaryCurrency: false });
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(wrapper.find(TokenInput).props().showFiat).toStrictEqual(true);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|