-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommonPage.spec.tsx
47 lines (36 loc) · 1.3 KB
/
CommonPage.spec.tsx
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* eslint-disable @typescript-eslint/no-explicit-any */
import '@testing-library/jest-dom';
import { act } from 'react';
import { render } from '@testing-library/react';
import { axe, toHaveNoViolations } from 'jest-axe';
import CommonPage from './CommonPage';
jest.mock('@contentful/live-preview/react', () => ({
useContentfulInspectorMode: () => jest.fn(),
useContentfulLiveUpdates: jest.fn((item) => item),
}));
beforeAll(() => {
expect.extend(toHaveNoViolations);
});
it('Passes accessibility with default props', async () => act(async () => {
const { container } = render(
<CommonPage
page={{ title: 'test-title', path: '/test-path' }}
breadcrumbs={[{ title: 'test-title', path: '/test-path' }]}
data={{ image: { url: '/test-url.jpg' } } as any}
/>,
);
const results = await axe(container);
expect(results).toHaveNoViolations();
}));
it('Passes accessibility with optional props', async () => act(async () => {
const { container } = render(
<CommonPage
page={{ title: 'test-title', path: '/test-path' }}
parent={{ title: 'test-parent-title', path: '/test-parent-path' }}
breadcrumbs={[{ title: 'test-title', path: '/test-path' }]}
data={{} as any}
/>,
);
const results = await axe(container);
expect(results).toHaveNoViolations();
}));