@@ -527,6 +527,66 @@ redirect_urls = [ "https://example.com/api/auth" ]
527527 expect ( app . errors ) . toBeUndefined ( )
528528 } )
529529
530+ test ( 'throws error for duplicated handles when mode is local' , async ( ) => {
531+ // Given
532+ await writeConfig ( appConfiguration )
533+
534+ const blockConfiguration = `
535+ api_version = "2022-07"
536+
537+ [[extensions]]
538+ type = "checkout_post_purchase"
539+ name = "my_extension_1"
540+ handle = "handle-1"
541+ description = "custom description"
542+
543+ [[extensions]]
544+ type = "flow_action"
545+ handle = "handle-1"
546+ name = "my_extension_1_flow"
547+ description = "custom description"
548+ runtime_url = "https://example.com"
549+ `
550+ await writeBlockConfig ( {
551+ blockConfiguration,
552+ name : 'my_extension_1' ,
553+ } )
554+ await writeFile ( joinPath ( blockPath ( 'my_extension_1' ) , 'index.js' ) , '' )
555+
556+ // When/Then
557+ await expect ( loadTestingApp ( { mode : 'local' } ) ) . rejects . toThrow ( / D u p l i c a t e d h a n d l e / )
558+ } )
559+
560+ test ( 'does not throw error for duplicated handles when mode is report' , async ( ) => {
561+ // Given
562+ await writeConfig ( appConfiguration )
563+
564+ const blockConfiguration = `
565+ api_version = "2022-07"
566+
567+ [[extensions]]
568+ type = "checkout_post_purchase"
569+ name = "my_extension_1"
570+ handle = "handle-1"
571+ description = "custom description"
572+
573+ [[extensions]]
574+ type = "flow_action"
575+ handle = "handle-1"
576+ name = "my_extension_1_flow"
577+ description = "custom description"
578+ runtime_url = "https://example.com"
579+ `
580+ await writeBlockConfig ( {
581+ blockConfiguration,
582+ name : 'my_extension_1' ,
583+ } )
584+ await writeFile ( joinPath ( blockPath ( 'my_extension_1' ) , 'index.js' ) , '' )
585+
586+ // When/Then
587+ await expect ( loadTestingApp ( { mode : 'report' } ) ) . resolves . not . toThrow ( )
588+ } )
589+
530590 test ( 'throws if 2 or more extensions have the same handle' , async ( ) => {
531591 // Given
532592 await writeConfig ( appConfiguration )
0 commit comments