2017-11-29 14:16:38 +01:00
|
|
|
/**
|
|
|
|
* NotFound component
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
2018-06-17 13:34:59 +02:00
|
|
|
import NotFound from '../../../../src/webui/src/components/NotFound/index';
|
2017-11-29 14:16:38 +01:00
|
|
|
|
|
|
|
console.error = jest.fn();
|
|
|
|
|
2017-12-02 13:34:42 +01:00
|
|
|
describe('<NotFound /> component', () => {
|
2017-11-29 14:16:38 +01:00
|
|
|
it('should give error for the required fields', () => {
|
|
|
|
shallow(<NotFound />);
|
|
|
|
expect(console.error).toBeCalled();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should set html from props', () => {
|
|
|
|
const props = {
|
|
|
|
pkg: 'verdaccio'
|
|
|
|
};
|
|
|
|
const wrapper = shallow(<NotFound {...props} />);
|
|
|
|
expect(wrapper.find('h1').text()).toEqual('Error 404 - verdaccio');
|
|
|
|
expect(wrapper.find('p').text()).toEqual(
|
|
|
|
'Oops, The package you are trying to access does not exist.'
|
|
|
|
);
|
2017-12-02 15:01:06 +01:00
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
2017-11-29 14:16:38 +01:00
|
|
|
});
|
|
|
|
});
|