1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/test/unit/webui/components/PackageSidebar/infos.spec.js
Juan Picado @jotadeveloper 49c6191bb5
refactor: relocate unit test
no logic change, just path updates
2018-06-23 20:57:12 +02:00

30 lines
956 B
JavaScript

/**
* Infos component
*/
import React from 'react';
import { mount, shallow } from 'enzyme';
import Infos from '../../../../../src/webui/src/components/PackageSidebar/modules/Infos/index';
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();
});
});