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/maintainerInfo.spec.js

31 lines
928 B
JavaScript
Raw Normal View History

2017-12-20 05:10:53 +01:00
/**
* MaintainerInfo component
*/
import React from 'react';
import { shallow } from 'enzyme';
import MaintainerInfo from '../../../../../src/webui/components/PackageSidebar/modules/Maintainers/MaintainerInfo/index';
2017-12-20 05:10:53 +01:00
console.error = jest.fn();
describe('<PackageSidebar /> : <Maintainers /> <MaintainerInfo />', () => {
2018-12-05 19:30:08 +01:00
test('should throw error for required props', () => {
2017-12-20 05:10:53 +01:00
shallow(<MaintainerInfo />);
expect(console.error).toBeCalled();
});
2018-12-05 19:30:08 +01:00
test('should load the component and match with snapshot', () => {
2017-12-20 05:10:53 +01:00
const props = {
title: 'test-title',
name: 'test',
avatar: 'http://xyz.com/profile.jpg'
};
const wrapper = shallow(<MaintainerInfo {...props} />);
expect(wrapper.find('.maintainer').prop('title')).toEqual('test');
expect(wrapper.find('img').prop('src')).toEqual(
'http://xyz.com/profile.jpg'
);
expect(wrapper.html()).toMatchSnapshot();
});
});