0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/test/webui/components/packagedetail.spec.js

34 lines
889 B
JavaScript
Raw Normal View History

2017-11-30 11:31:25 -05:00
/**
* PackageDetail component
*/
import React from 'react';
import { shallow } from 'enzyme';
import PackageDetail from '../../../src/webui/src/components/PackageDetail';
2017-12-01 14:04:01 -05:00
import Readme from '../../../src/webui/src/components/Readme';
2017-11-30 11:31:25 -05:00
console.error = jest.fn();
describe('<PackageDetail /> component', () => {
it('should give error for required props', () => {
shallow(<PackageDetail />);
expect(console.error).toBeCalled();
});
it('should load the component', () => {
const props = {
readMe: 'Test readme',
package: 'Verdaccio'
};
const wrapper = shallow(<PackageDetail {...props} />);
2017-12-01 14:04:01 -05:00
2017-11-30 11:31:25 -05:00
expect(wrapper.find('h1').text()).toEqual('Verdaccio');
2017-12-01 14:04:01 -05:00
expect(
wrapper
.find(Readme)
.dive()
.html()
).toEqual('<div class="markdown-body">Test readme</div>');
expect(wrapper.html()).toMatchSnapshot();
2017-11-30 11:31:25 -05:00
});
});