1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-04 23:14:56 +01:00
metamask-extension/ui/components/app/user-preferenced-token-input/user-preferenced-token-input.component.test.js
2021-06-06 12:45:27 -02:30

33 lines
1.1 KiB
JavaScript

import React from 'react';
import { shallow } from 'enzyme';
import TokenInput from '../../ui/token-input';
import UserPreferencedTokenInput from './user-preferenced-token-input.component';
describe('UserPreferencedCurrencyInput Component', () => {
describe('rendering', () => {
it('should render properly', () => {
const wrapper = shallow(
<UserPreferencedTokenInput token={{ address: '0x0' }} />,
);
expect(wrapper).toHaveLength(1);
expect(wrapper.find(TokenInput)).toHaveLength(1);
});
it('should render showFiat for TokenInput based on preferences.useNativeCurrencyAsPrimaryCurrency', () => {
const wrapper = shallow(
<UserPreferencedTokenInput
token={{ address: '0x0' }}
useNativeCurrencyAsPrimaryCurrency
/>,
);
expect(wrapper).toHaveLength(1);
expect(wrapper.find(TokenInput)).toHaveLength(1);
expect(wrapper.find(TokenInput).props().showFiat).toStrictEqual(false);
wrapper.setProps({ useNativeCurrencyAsPrimaryCurrency: false });
expect(wrapper.find(TokenInput).props().showFiat).toStrictEqual(true);
});
});
});