@findify/react-components
Version:
Findify react UI components
43 lines (42 loc) • 1.14 kB
JSX
import { fromJS } from 'immutable';
import ProductCardView from './index';
import theme from './styles.css';
import { shallow } from 'enzyme';
const itemMock = fromJS({
product_url: 'https://foo.bar',
image_url: 'https://lorempicsum.net/100/100',
description: 'A description for item',
thumbnail_url: 'https://lorempicsum.net/50/50',
title: 'Product Title',
price: '9.99',
reviews: { average_rating: 0 },
});
const configMock = fromJS({
productcard: {
title: {
display: true,
lines: 1,
},
description: {
display: true,
lines: 2,
},
price: {
display: true,
},
},
currency_config: {
code: 'USD',
symbol: '$',
thousand: ',',
decimalSeparator: '.',
symbolOnLeft: true,
spaceBetweenAmountAndSymbol: false,
decimalDigits: 2,
},
});
describe('ProductCard view', () => {
it('renders correctly', () => {
expect(shallow(<ProductCardView theme={{}} item={itemMock} config={configMock} theme={theme}/>)).toMatchSnapshot();
});
});