2017-11-29 08:16:38 -05:00
|
|
|
/**
|
|
|
|
* NotFound component
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
2018-10-31 07:42:43 -05:00
|
|
|
import { shallow, mount } from 'enzyme';
|
2018-07-17 14:22:44 -05:00
|
|
|
import NotFound from '../../../../src/webui/components/NotFound/index';
|
2017-11-29 08:16:38 -05:00
|
|
|
|
|
|
|
console.error = jest.fn();
|
|
|
|
|
2017-12-02 07:34:42 -05:00
|
|
|
describe('<NotFound /> component', () => {
|
2018-12-05 13:30:08 -05:00
|
|
|
test('should load the component in default state', () => {
|
2018-12-14 18:23:30 -05:00
|
|
|
const wrapper = mount(<NotFound pkg={ "test" } />);
|
2018-10-31 07:42:43 -05:00
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
2017-11-29 08:16:38 -05:00
|
|
|
});
|
|
|
|
|
2018-12-05 13:30:08 -05:00
|
|
|
test('should set html from props', () => {
|
2017-11-29 08:16:38 -05:00
|
|
|
const props = {
|
|
|
|
pkg: 'verdaccio'
|
|
|
|
};
|
2018-12-14 18:23:30 -05:00
|
|
|
const wrapper = shallow(<NotFound { ...props } />);
|
2017-11-29 08:16:38 -05:00
|
|
|
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 09:01:06 -05:00
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
2017-11-29 08:16:38 -05:00
|
|
|
});
|
|
|
|
});
|