@@ -266,6 +266,43 @@ describe('chooseLanguageLetterTemplatesAction', () => {
266266 'You can only choose one template for each language'
267267 ) ;
268268 } ) ;
269+
270+ test ( 'should return error when lockNumber is missing' , async ( ) => {
271+ const result = await chooseLanguageLetterTemplatesAction (
272+ {
273+ messagePlan : ROUTING_CONFIG ,
274+ cascadeIndex : 0 ,
275+ templateList : [ FRENCH_LETTER ] ,
276+ pageHeading : 'Choose language templates' ,
277+ } ,
278+ getMockFormData ( {
279+ [ `template_${ FRENCH_LETTER . id } ` ] : `${ FRENCH_LETTER . id } :fr` ,
280+ } )
281+ ) ;
282+
283+ expect ( result . errorState ) . toBeDefined ( ) ;
284+ expect ( mockUpdateRoutingConfig ) . not . toHaveBeenCalled ( ) ;
285+ expect ( mockRedirect ) . not . toHaveBeenCalled ( ) ;
286+ } ) ;
287+
288+ test ( 'should return error when lockNumber is invalid' , async ( ) => {
289+ const result = await chooseLanguageLetterTemplatesAction (
290+ {
291+ messagePlan : ROUTING_CONFIG ,
292+ cascadeIndex : 0 ,
293+ templateList : [ FRENCH_LETTER ] ,
294+ pageHeading : 'Choose language templates' ,
295+ } ,
296+ getMockFormData ( {
297+ [ `template_${ FRENCH_LETTER . id } ` ] : `${ FRENCH_LETTER . id } :fr` ,
298+ lockNumber : 'invalid' ,
299+ } )
300+ ) ;
301+
302+ expect ( result . errorState ) . toBeDefined ( ) ;
303+ expect ( mockUpdateRoutingConfig ) . not . toHaveBeenCalled ( ) ;
304+ expect ( mockRedirect ) . not . toHaveBeenCalled ( ) ;
305+ } ) ;
269306} ) ;
270307
271308describe ( '$ChooseLanguageLetterTemplates Zod schema' , ( ) => {
0 commit comments