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