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';
|
|
|
|
import { mount, shallow } from 'enzyme';
|
2018-06-17 13:34:59 +02:00
|
|
|
import Infos from '../../../../../src/webui/src/components/PackageSidebar/modules/Infos/index';
|
2018-06-14 00:34:25 +02:00
|
|
|
import { packageMeta } from '../store/packageMeta';
|
|
|
|
|
|
|
|
console.error = jest.fn();
|
|
|
|
|
|
|
|
describe('<PackageSidebar /> : <Infos />', () => {
|
|
|
|
it('should load the component and check getter: info with package data', () => {
|
|
|
|
const wrapper = mount(<Infos packageMeta={packageMeta} />);
|
|
|
|
const instance = wrapper.instance();
|
|
|
|
const result = {
|
|
|
|
repo: { type: 'git', url: 'git://github.com/verdaccio/verdaccio.git' },
|
|
|
|
homepage: { url: 'https://github.com/verdaccio/verdaccio#readme' },
|
|
|
|
license: 'WTFPL'
|
|
|
|
};
|
|
|
|
|
|
|
|
expect(instance.infos).toEqual(result);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should load the Info component and match snapshot', () => {
|
|
|
|
const wrapper = shallow(<Infos packageMeta={packageMeta} />);
|
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|