UNPKG

@findify/react-components

Version:
71 lines (70 loc) 2.56 kB
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } import { fromJS } from 'immutable'; import ProductCardView from "./index"; var theme = { "root": "findify-components--cards--product", "vertical": "findify-components--cards--product__vertical", "horizontal": "findify-components--cards--product__horizontal", "autocomplete": "findify-components--cards--product__autocomplete", "highlighted": "findify-components--cards--product__highlighted", "content": "findify-components--cards--product__content", "image": "findify-components--cards--product__image", "divider": "findify-components--cards--product__divider", "title": "findify-components--cards--product__title", "title-link": "findify-components--cards--product__title-link", "description": "findify-components--cards--product__description", "rating": "findify-components--cards--product__rating", "color": "findify-components--cards--product__color", "out-of-stock": "findify-components--cards--product__out-of-stock", "discount-sticker": "findify-components--cards--product__discount-sticker", "variants": "findify-components--cards--product__variants", "titleLink": "findify-components--cards--product__title-link", "outOfStock": "findify-components--cards--product__out-of-stock", "discountSticker": "findify-components--cards--product__discount-sticker" }; import { shallow } from 'enzyme'; import { jsx as _jsx } from "react/jsx-runtime"; var 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 } }); var 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', function () { it('renders correctly', function () { expect(shallow( /*#__PURE__*/_jsx(ProductCardView, _defineProperty({ theme: {}, item: itemMock, config: configMock }, "theme", theme)))).toMatchSnapshot(); }); });