@@ -479,6 +479,66 @@ wrong = "property"
479479 expect ( app . errors ) . toBeUndefined ( )
480480 } )
481481
482+ test ( 'throws error for duplicated handles when mode is local' , async ( ) => {
483+ // Given
484+ await writeConfig ( appConfiguration )
485+
486+ const blockConfiguration = `
487+ api_version = "2022-07"
488+
489+ [[extensions]]
490+ type = "checkout_post_purchase"
491+ name = "my_extension_1"
492+ handle = "handle-1"
493+ description = "custom description"
494+
495+ [[extensions]]
496+ type = "flow_action"
497+ handle = "handle-1"
498+ name = "my_extension_1_flow"
499+ description = "custom description"
500+ runtime_url = "https://example.com"
501+ `
502+ await writeBlockConfig ( {
503+ blockConfiguration,
504+ name : 'my_extension_1' ,
505+ } )
506+ await writeFile ( joinPath ( blockPath ( 'my_extension_1' ) , 'index.js' ) , '' )
507+
508+ // When/Then
509+ await expect ( loadTestingApp ( { mode : 'local' } ) ) . rejects . toThrow ( / D u p l i c a t e d h a n d l e / )
510+ } )
511+
512+ test ( 'does not throw error for duplicated handles when mode is report' , async ( ) => {
513+ // Given
514+ await writeConfig ( appConfiguration )
515+
516+ const blockConfiguration = `
517+ api_version = "2022-07"
518+
519+ [[extensions]]
520+ type = "checkout_post_purchase"
521+ name = "my_extension_1"
522+ handle = "handle-1"
523+ description = "custom description"
524+
525+ [[extensions]]
526+ type = "flow_action"
527+ handle = "handle-1"
528+ name = "my_extension_1_flow"
529+ description = "custom description"
530+ runtime_url = "https://example.com"
531+ `
532+ await writeBlockConfig ( {
533+ blockConfiguration,
534+ name : 'my_extension_1' ,
535+ } )
536+ await writeFile ( joinPath ( blockPath ( 'my_extension_1' ) , 'index.js' ) , '' )
537+
538+ // When/Then
539+ await expect ( loadTestingApp ( { mode : 'report' } ) ) . resolves . not . toThrow ( )
540+ } )
541+
482542 test ( 'throws if 2 or more extensions have the same handle' , async ( ) => {
483543 // Given
484544 await writeConfig ( appConfiguration )
0 commit comments