0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-20 22:52:46 -05:00
verdaccio/test/unit/webui/components/PackageSidebar/module.spec.js

30 lines
727 B
JavaScript
Raw Normal View History

2017-12-20 09:40:53 +05:30
/**
* Module component
*/
import React from 'react';
import { shallow } from 'enzyme';
import Module from '../../../../../src/webui/components/PackageSidebar/Module/index';
2017-12-20 09:40:53 +05:30
console.error = jest.fn();
describe('<PackageSidebar /> : <Module />', () => {
2018-12-05 19:30:08 +01:00
test('should error for required props', () => {
2017-12-20 09:40:53 +05:30
shallow(<Module />);
2018-12-16 21:09:03 +01:00
expect(console.error).toHaveBeenCalled();
2017-12-20 09:40:53 +05:30
});
2018-12-05 19:30:08 +01:00
test('should load module component', () => {
2017-12-20 09:40:53 +05:30
const props = {
title: 'Test title',
description: 'Test description',
className: 'module-component'
};
const wrapper = shallow(
<Module {...props}>
<p>{'test children'}</p>
2017-12-20 09:40:53 +05:30
</Module>
);
expect(wrapper.html()).toMatchSnapshot();
});
});