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 CurrencyInput from '../../ui/currency-input';
|
|
|
|
import UserPreferencedCurrencyInput from './user-preferenced-currency-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', () => {
|
2021-02-04 19:15:23 +01:00
|
|
|
const wrapper = shallow(<UserPreferencedCurrencyInput />);
|
2018-10-17 01:03:29 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(wrapper).toHaveLength(1);
|
|
|
|
expect(wrapper.find(CurrencyInput)).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 useFiat for CurrencyInput based on preferences.useNativeCurrencyAsPrimaryCurrency', () => {
|
2018-10-17 01:03:29 +02:00
|
|
|
const wrapper = shallow(
|
2020-11-03 00:41:28 +01:00
|
|
|
<UserPreferencedCurrencyInput useNativeCurrencyAsPrimaryCurrency />,
|
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(CurrencyInput)).toHaveLength(1);
|
|
|
|
expect(wrapper.find(CurrencyInput).props().useFiat).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(CurrencyInput).props().useFiat).toStrictEqual(true);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|