Skip to content

Commit 627dfd9

Browse files
committed
CCM-8580: fixes post 15 rebase
1 parent 4a3105c commit 627dfd9

File tree

3 files changed

+9
-31
lines changed

3 files changed

+9
-31
lines changed

frontend/src/__tests__/app/copy-template/page.test.tsx

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,41 +35,13 @@ describe('CopyTemplatePage', () => {
3535
it('should load page', async () => {
3636
getTemplateMock.mockResolvedValueOnce(template);
3737

38-
const page = await CopyTemplatePage({
39-
params: {
40-
templateId: 'template-id',
41-
},
42-
});
43-
44-
expect(page).toEqual(
45-
<CopyTemplate
46-
template={template}
47-
templateTypes={Object.values(TemplateType)}
48-
/>
49-
);
50-
});
51-
52-
it('Letter option is hidden when the feature flag is not enabled', async () => {
53-
process.env.NEXT_PUBLIC_ENABLE_LETTERS = 'false';
54-
55-
getTemplateMock.mockResolvedValueOnce(template);
56-
5738
const page = await CopyTemplatePage({
5839
params: Promise.resolve({
5940
templateId: 'template-id',
6041
}),
6142
});
6243

63-
expect(page).toEqual(
64-
<CopyTemplate
65-
template={template}
66-
templateTypes={[
67-
TemplateType.NHS_APP,
68-
TemplateType.EMAIL,
69-
TemplateType.SMS,
70-
]}
71-
/>
72-
);
44+
expect(page).toEqual(<CopyTemplate template={template} />);
7345
});
7446

7547
it('should redirect to invalid-template when no templateId is found', async () => {

frontend/src/__tests__/app/create-letter-template/page.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ describe('CreateLetterTemplatePage', () => {
1515
it('returns 404 when letters feature flag is not enabled', async () => {
1616
process.env.NEXT_PUBLIC_ENABLE_LETTERS = 'false';
1717

18-
await expect(CreateLetterTemplatePage()).rejects.toThrow('NEXT_NOT_FOUND');
18+
await expect(CreateLetterTemplatePage()).rejects.toThrow(
19+
'NEXT_HTTP_ERROR_FALLBACK;404'
20+
);
1921
});
2022
});

frontend/src/components/forms/ChooseTemplate/ChooseTemplate.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ import {
1313
import { NHSNotifyMain } from '@atoms/NHSNotifyMain/NHSNotifyMain';
1414
import { chooseTemplateAction } from './server-action';
1515

16-
export const ChooseTemplate = () => {
16+
export const ChooseTemplate = ({
17+
templateTypes,
18+
}: {
19+
templateTypes: TemplateType[];
20+
}) => {
1721
const [state, action] = useActionState(chooseTemplateAction, {});
1822

1923
const options = templateTypes.map((templateType) => ({

0 commit comments

Comments
 (0)