/** * PackageDetail component */ import React from 'react'; import { shallow } from 'enzyme'; import PackageDetail from '../../../../src/webui/components/PackageDetail/index'; import Readme from '../../../../src/webui/components/Readme/index'; import {WEB_TITLE} from '../../../../src/lib/constants'; console.error = jest.fn(); describe(' component', () => { it('should give error for required props', () => { shallow(); expect(console.error).toBeCalled(); }); it('should load the component', () => { const props = { readMe: 'Test readme', packageName: WEB_TITLE }; const wrapper = shallow(); expect(wrapper.find('h1').text()).toEqual(WEB_TITLE); expect( wrapper .find(Readme) .dive() .html() ).toEqual('
Test readme
'); expect(wrapper.html()).toMatchSnapshot(); }); });