@@ -571,6 +571,59 @@ describe( 'ReportError', () => {
571571 expect ( invalidateResolutionSpy ) . toHaveBeenCalledTimes ( 4 ) ;
572572 } ) ;
573573
574+ it ( 'should not list error descriptions with the same `reconnectURL`s' , async ( ) => {
575+ const { container, waitForRegistry } = render (
576+ < ReportError
577+ moduleSlug = { moduleName }
578+ error = { [
579+ {
580+ code : 'test_error' ,
581+ message : 'Test error message' ,
582+ data : {
583+ reason : '' ,
584+ reconnectURL : 'https://example.com/page?code=1' ,
585+ status : 401 ,
586+ } ,
587+ } ,
588+ {
589+ code : 'test_error' ,
590+ message : 'Test error message' ,
591+ data : {
592+ reason : '' ,
593+ reconnectURL : 'https://example.com/page?code=2' ,
594+ status : 401 ,
595+ } ,
596+ } ,
597+ {
598+ code : 'test_error' ,
599+ message : 'Test error message 2' ,
600+ data : {
601+ reason : '' ,
602+ reconnectURL : 'https://example.com/page2?code=1' ,
603+ status : 401 ,
604+ } ,
605+ } ,
606+ ] }
607+ /> ,
608+ {
609+ registry,
610+ }
611+ ) ;
612+
613+ await waitForRegistry ( ) ;
614+
615+ const errorDescriptionElement = container . querySelectorAll (
616+ '.googlesitekit-cta__description'
617+ ) ;
618+
619+ // Verify the child element count for the error description element is two.
620+ // However, the passed error array has three repetitive error objects.
621+ // The second error is not listed because it has the same `message` and `reconnectURL`
622+ // as the first one. Note that the `code` query parameter in the `reconnectURL` is
623+ // ignored for comparison, as it is expected to be different for each URL.
624+ expect ( errorDescriptionElement [ 0 ] . childElementCount ) . toBe ( 2 ) ;
625+ } ) ;
626+
574627 it ( 'should render `Get help` link without prefix text on non-retryable error' , async ( ) => {
575628 await registry . dispatch ( MODULES_ANALYTICS_4 ) . receiveError (
576629 {
0 commit comments