-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAdminPage.test.tsx
More file actions
71 lines (62 loc) · 2.8 KB
/
AdminPage.test.tsx
File metadata and controls
71 lines (62 loc) · 2.8 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { render, screen } from '@testing-library/react';
import { AdminPage } from './AdminPage';
import { runAxeTest } from '../../helpers/test/axeTestHelper';
import { describe, expect, it } from 'vitest';
import { routeChildren } from '../../types/generic/routes';
vi.mock('../../../helpers/hooks/useTitle');
vi.mock('../../styles/right-chevron-circle.svg', () => ({
ReactComponent: () => 'svg',
}));
describe('AdminPage', (): void => {
describe('Rendering', (): void => {
it('renders the admin hub heading', (): void => {
render(<AdminPage />);
expect(screen.getByRole('heading', { name: 'Admin hub' })).toBeInTheDocument();
});
it('renders the Review documents card', (): void => {
render(<AdminPage />);
const reviewsLink = screen.getByTestId('admin-reviews-btn');
expect(reviewsLink).toBeInTheDocument();
expect(reviewsLink).toHaveTextContent('Review documents');
});
it('renders the Review documents card with correct href', (): void => {
render(<AdminPage />);
const reviewsLink = screen.getByTestId('admin-reviews-btn');
expect(reviewsLink).toHaveAttribute('href', routeChildren.ADMIN_REVIEW);
});
it('renders the Review documents card description', (): void => {
render(<AdminPage />);
expect(
screen.getByText(
'Review patient documents from practice to practice transfers, or rejections from bulk transfer into this service.',
),
).toBeInTheDocument();
});
it('renders the Download a report card', (): void => {
render(<AdminPage />);
const reportLink = screen.getByTestId('download-report-btn');
expect(reportLink).toBeInTheDocument();
expect(reportLink).toHaveTextContent('Download a report');
});
it('renders the Download a report card with correct href', (): void => {
render(<AdminPage />);
const reportLink = screen.getByTestId('download-report-btn');
expect(reportLink).toHaveAttribute('href', '/create-report?reportType=0');
});
it('renders the Download a report card description', (): void => {
render(<AdminPage />);
expect(
screen.getByText(
'This report shows the list of Lloyd George records stored for your organisation.',
),
).toBeInTheDocument();
});
});
describe('Accessibility', (): void => {
it('passes accessibility checks', async (): Promise<void> => {
render(<AdminPage />);
const results = await runAxeTest(document.body);
expect(results).toHaveNoViolations();
});
});
});