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.
28 lines
1.1 KiB
28 lines
1.1 KiB
4 years ago
|
import React from 'react';
|
||
|
import { shallow } from 'enzyme';
|
||
4 years ago
|
import CurrencyInput from '../../ui/currency-input';
|
||
|
import UserPreferencedCurrencyInput from './user-preferenced-currency-input.component';
|
||
6 years ago
|
|
||
4 years ago
|
describe('UserPreferencedCurrencyInput Component', () => {
|
||
|
describe('rendering', () => {
|
||
|
it('should render properly', () => {
|
||
4 years ago
|
const wrapper = shallow(<UserPreferencedCurrencyInput />);
|
||
6 years ago
|
|
||
4 years ago
|
expect(wrapper).toHaveLength(1);
|
||
|
expect(wrapper.find(CurrencyInput)).toHaveLength(1);
|
||
4 years ago
|
});
|
||
6 years ago
|
|
||
4 years ago
|
it('should render useFiat for CurrencyInput based on preferences.useNativeCurrencyAsPrimaryCurrency', () => {
|
||
6 years ago
|
const wrapper = shallow(
|
||
4 years ago
|
<UserPreferencedCurrencyInput useNativeCurrencyAsPrimaryCurrency />,
|
||
4 years ago
|
);
|
||
6 years ago
|
|
||
4 years ago
|
expect(wrapper).toHaveLength(1);
|
||
|
expect(wrapper.find(CurrencyInput)).toHaveLength(1);
|
||
|
expect(wrapper.find(CurrencyInput).props().useFiat).toStrictEqual(false);
|
||
4 years ago
|
wrapper.setProps({ useNativeCurrencyAsPrimaryCurrency: false });
|
||
4 years ago
|
expect(wrapper.find(CurrencyInput).props().useFiat).toStrictEqual(true);
|
||
4 years ago
|
});
|
||
|
});
|
||
|
});
|