generated from NHSDigital/nhs-notify-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpage.test.tsx
More file actions
31 lines (24 loc) · 752 Bytes
/
page.test.tsx
File metadata and controls
31 lines (24 loc) · 752 Bytes
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
/**
* @jest-environment node
*/
import CreateLetterTemplatePage from '@app/create-letter-template/page';
const OLD_ENV = { ...process.env };
describe('CreateLetterTemplatePage', () => {
beforeEach(() => {
jest.resetAllMocks();
process.env.NEXT_PUBLIC_ENABLE_LETTERS = 'true';
});
afterAll(() => {
process.env = OLD_ENV;
});
it('should render CreateLetterTemplatePage', async () => {
const page = await CreateLetterTemplatePage();
expect(page).toMatchSnapshot();
});
it('returns 404 when letters feature flag is not enabled', async () => {
process.env.NEXT_PUBLIC_ENABLE_LETTERS = 'false';
await expect(CreateLetterTemplatePage()).rejects.toThrow(
'NEXT_HTTP_ERROR_FALLBACK;404'
);
});
});