2018-06-14 00:34:25 +02:00
|
|
|
/**
|
2018-06-14 08:43:01 +02:00
|
|
|
* Infos component
|
2018-06-14 00:34:25 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
2018-07-21 20:49:10 +02:00
|
|
|
import { shallow } from 'enzyme';
|
2018-07-17 21:22:44 +02:00
|
|
|
import Infos from '../../../../../src/webui/components/PackageSidebar/modules/Infos/index';
|
2018-06-14 00:34:25 +02:00
|
|
|
|
|
|
|
describe('<PackageSidebar /> : <Infos />', () => {
|
2018-07-21 20:49:10 +02:00
|
|
|
it('should load the component without props', () => {
|
|
|
|
const wrapper = shallow(<Infos/>);
|
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should load the Info component with props', () => {
|
|
|
|
const props = {
|
|
|
|
homepage: 'https://www.verdaccio.org',
|
|
|
|
license: 'MIT',
|
|
|
|
repository: 'https://github.com/verdaccio/verdaccio'
|
|
|
|
}
|
|
|
|
const wrapper = shallow(<Infos {...props}/>);
|
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
|
|
|
});
|
2018-06-14 00:34:25 +02:00
|
|
|
|
2018-07-21 20:49:10 +02:00
|
|
|
it('should load the Info component with homepage only', () => {
|
|
|
|
const props = {
|
|
|
|
homepage: 'https://www.verdaccio.org'
|
|
|
|
}
|
|
|
|
const wrapper = shallow(<Infos {...props} />);
|
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should load the Info component with license only', () => {
|
|
|
|
const props = {
|
|
|
|
license: 'MIT',
|
|
|
|
}
|
|
|
|
const wrapper = shallow(<Infos {...props} />);
|
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
2018-06-14 00:34:25 +02:00
|
|
|
});
|
|
|
|
|
2018-07-21 20:49:10 +02:00
|
|
|
it('should load the Info component with repository only', () => {
|
|
|
|
const props = { repository: 'https://github.com/verdaccio/verdaccio' };
|
|
|
|
const wrapper = shallow(<Infos {...props} />);
|
2018-06-14 00:34:25 +02:00
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|