blob: f205ce9365ac947d56543fd13ddd1662f1665433 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import { mount } from '@vue/test-utils';
import ErrorMessage from '../../../../content/frontend/404/components/error_message.vue';
const propsData = { isProduction: true, isOffline: false, archivesPath: '/archives/' };
describe('component: Error Message', () => {
let wrapper;
beforeEach(() => {
wrapper = mount(ErrorMessage, { propsData });
});
it('renders a heading with correct text', () => {
expect(wrapper.find('h2').exists()).toBe(true);
expect(wrapper.find('h2').text()).toEqual("There's no page at this address!");
});
it('does not render an error description if not offline', () => {
expect(wrapper.find('.js-error-description').exists()).toBe(false);
});
it('renders an error description if isOffline is true', () => {
wrapper = mount(ErrorMessage, { propsData: { ...propsData, isOffline: true } });
expect(wrapper.find('.js-error-description').exists()).toBe(true);
expect(wrapper.find('.js-error-description a').exists()).toBe(true);
});
});
|