@shopgate/pwa-common
Version:
Common library for the Shopgate Connect PWA.
1 lines • 876 B
JavaScript
/* eslint-disable no-console */import React from'react';import{shallow}from'enzyme';import List from"./index";console.error=jest.fn();describe('<List />',function(){var children=[React.createElement(List.Item,{key:"0"}),React.createElement(List.Item,{key:"1"}),React.createElement(List.Item,{key:"2"})];beforeEach(function(){jest.clearAllMocks();});it('renders with children',function(){var numChildren=children.length;var wrapper=shallow(React.createElement(List,null,children));expect(wrapper).toMatchSnapshot();expect(wrapper.find(List.Item).length).toBe(numChildren);expect(console.error).not.toHaveBeenCalled();});it('renders without children',function(){var wrapper=shallow(React.createElement(List,null));expect(wrapper).toMatchSnapshot();expect(wrapper.find(List.Item).length).toBe(0);expect(console.error).toHaveBeenCalledTimes(1);});});/* eslint-enable no-console */