UNPKG

yoda-common-boilerplate

Version:

Repository of all JCP reusable atoms, molecules and organisms

54 lines (43 loc) 1.27 kB
import React from 'react'; import { shallow } from 'enzyme'; import { expect } from 'chai'; import sinon from 'sinon'; import 'ignore-styles'; import List from '../List.jsx'; /* Sample data for list component */ const listArr = [ { text: 'Item 1', id: 1 }, { text: 'Item 2', originalPrice: '44', id: 2 }, { text: 'Item 3', originalPrice: '44', id: 3 } ]; const listitemRenderer = dataItem => <span key={dataItem.id}>{dataItem.text}</span>; describe(' Test Suite for <List /> ', () => { let wrapper; beforeEach(() => { //Shallow Rendering component in before each to eliminate duplication wrapper = shallow(<List title="List" datasource={listArr} childRenderer={listitemRenderer} />); }); it('List component should exist ', () => { expect(wrapper).to.exist; }); it.skip('renders the root div with right calls to renderTitle() and renderList()', () => { expect(wrapper.find('h3')).to.equal('abc'); }); it.skip('component should contain a div tag as a parent', () => { expect(wrapper.type()).to.equal('div'); }); it.skip('should be able to render children', () => { expect(wrapper.props().children).to.equal('Product Name:'); }); });