File tree Expand file tree Collapse file tree 3 files changed +9
-31
lines changed
components/forms/ChooseTemplate Expand file tree Collapse file tree 3 files changed +9
-31
lines changed Original file line number Diff line number Diff 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 ( ) => {
Original file line number Diff line number Diff 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} ) ;
Original file line number Diff line number Diff line change @@ -13,7 +13,11 @@ import {
1313import { NHSNotifyMain } from '@atoms/NHSNotifyMain/NHSNotifyMain' ;
1414import { 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 ) => ( {
You can’t perform that action at this time.
0 commit comments