UNPKG

@shopgate/pwa-common

Version:

Common library for the Shopgate Connect PWA.

28 lines 1.02 kB
/* eslint-disable no-console */ import React from 'react'; import { shallow } from 'enzyme'; import List from "./index"; import { jsx as _jsx } from "react/jsx-runtime"; console.error = jest.fn(); describe('<List />', () => { const children = [/*#__PURE__*/_jsx(List.Item, {}, "0"), /*#__PURE__*/_jsx(List.Item, {}, "1"), /*#__PURE__*/_jsx(List.Item, {}, "2")]; beforeEach(() => { jest.clearAllMocks(); }); it('renders with children', () => { const numChildren = children.length; const wrapper = shallow(/*#__PURE__*/_jsx(List, { children: children })); expect(wrapper).toMatchSnapshot(); expect(wrapper.find(List.Item).length).toBe(numChildren); expect(console.error).not.toHaveBeenCalled(); }); it('renders without children', () => { const wrapper = shallow(/*#__PURE__*/_jsx(List, {})); expect(wrapper).toMatchSnapshot(); expect(wrapper.find(List.Item).length).toBe(0); expect(console.error).toHaveBeenCalledTimes(1); }); }); /* eslint-enable no-console */