mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-10 09:33:51 +00:00
Added new card styles to error pages
This commit is contained in:
@@ -1,34 +1,34 @@
|
||||
import { shallow, ShallowWrapper } from 'enzyme';
|
||||
import { Link } from 'react-router-dom';
|
||||
import NotFound from '../../src/common/NotFound';
|
||||
import { SimpleCard } from '../../src/utils/SimpleCard';
|
||||
|
||||
describe('<NotFound />', () => {
|
||||
let wrapper: ShallowWrapper;
|
||||
const createWrapper = (props = {}) => {
|
||||
wrapper = shallow(<NotFound {...props} />);
|
||||
const content = wrapper.text();
|
||||
wrapper = shallow(<NotFound {...props} />).find(SimpleCard);
|
||||
|
||||
return { wrapper, content };
|
||||
return wrapper;
|
||||
};
|
||||
|
||||
afterEach(() => wrapper?.unmount());
|
||||
|
||||
it('shows expected error title', () => {
|
||||
const { content } = createWrapper();
|
||||
const wrapper = createWrapper();
|
||||
|
||||
expect(content).toContain('Oops! We could not find requested route.');
|
||||
expect(wrapper.contains('Oops! We could not find requested route.')).toEqual(true);
|
||||
});
|
||||
|
||||
it('shows expected error message', () => {
|
||||
const { content } = createWrapper();
|
||||
const wrapper = createWrapper();
|
||||
|
||||
expect(content).toContain(
|
||||
expect(wrapper.contains(
|
||||
'Use your browser\'s back button to navigate to the page you have previously come from, or just press this button.',
|
||||
);
|
||||
)).toEqual(true);
|
||||
});
|
||||
|
||||
it('shows a link to the home', () => {
|
||||
const { wrapper } = createWrapper();
|
||||
const wrapper = createWrapper();
|
||||
const link = wrapper.find(Link);
|
||||
|
||||
expect(link.prop('to')).toEqual('/');
|
||||
@@ -37,7 +37,7 @@ describe('<NotFound />', () => {
|
||||
});
|
||||
|
||||
it('shows a link with provided props', () => {
|
||||
const { wrapper } = createWrapper({ to: '/foo/bar', children: 'Hello' });
|
||||
const wrapper = createWrapper({ to: '/foo/bar', children: 'Hello' });
|
||||
const link = wrapper.find(Link);
|
||||
|
||||
expect(link.prop('to')).toEqual('/foo/bar');
|
||||
|
||||
Reference in New Issue
Block a user