2017-12-19 23:10:53 -05:00
|
|
|
/**
|
|
|
|
* Module component
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
2018-07-17 14:22:44 -05:00
|
|
|
import Module from '../../../../../src/webui/components/PackageSidebar/Module/index';
|
2017-12-19 23:10:53 -05:00
|
|
|
|
|
|
|
console.error = jest.fn();
|
|
|
|
|
|
|
|
describe('<PackageSidebar /> : <Module />', () => {
|
2018-12-05 13:30:08 -05:00
|
|
|
test('should error for required props', () => {
|
2017-12-19 23:10:53 -05:00
|
|
|
shallow(<Module />);
|
2018-12-16 15:09:03 -05:00
|
|
|
expect(console.error).toHaveBeenCalled();
|
2017-12-19 23:10:53 -05:00
|
|
|
});
|
2018-12-05 13:30:08 -05:00
|
|
|
test('should load module component', () => {
|
2017-12-19 23:10:53 -05:00
|
|
|
const props = {
|
|
|
|
title: 'Test title',
|
|
|
|
description: 'Test description',
|
|
|
|
className: 'module-component'
|
|
|
|
};
|
|
|
|
const wrapper = shallow(
|
2018-12-15 10:39:51 -05:00
|
|
|
<Module {...props}>
|
2019-01-06 05:33:15 -05:00
|
|
|
<p>{'test children'}</p>
|
2017-12-19 23:10:53 -05:00
|
|
|
</Module>
|
|
|
|
);
|
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|