@@ -744,6 +744,67 @@ describe('ReportUtils', () => {
744744 } ) ;
745745 } ) ;
746746
747+ describe ( 'Fallback scenarios' , ( ) => {
748+ test ( 'should fallback to report.reportName when primary name generation returns empty string' , ( ) => {
749+ const reportWithFallbackName : Report = {
750+ reportID : '3' ,
751+ reportName : 'Custom Report Name' ,
752+ ownerAccountID : undefined ,
753+ participants : { } ,
754+ policyID : undefined ,
755+ chatType : undefined ,
756+ } ;
757+
758+ const result = getReportName ( reportWithFallbackName ) ;
759+ expect ( result ) . toBe ( 'Custom Report Name' ) ;
760+ } ) ;
761+
762+ test ( 'should return empty string when both primary name generation and reportName are empty' , ( ) => {
763+ const reportWithoutName : Report = {
764+ reportID : '4' ,
765+ reportName : '' ,
766+ ownerAccountID : undefined ,
767+ participants : { } ,
768+ policyID : undefined ,
769+ chatType : undefined ,
770+ } ;
771+
772+ const result = getReportName ( reportWithoutName ) ;
773+ expect ( result ) . toBe ( '' ) ;
774+ } ) ;
775+
776+ test ( 'should return empty string when reportName is undefined' , ( ) => {
777+ const reportWithUndefinedName : Report = {
778+ reportID : '5' ,
779+ reportName : undefined ,
780+ ownerAccountID : undefined ,
781+ participants : { } ,
782+ policyID : undefined ,
783+ chatType : undefined ,
784+ } ;
785+
786+ const result = getReportName ( reportWithUndefinedName ) ;
787+ expect ( result ) . toBe ( '' ) ;
788+ } ) ;
789+
790+ test ( 'should return Concierge display name for concierge chat report' , async ( ) => {
791+ const conciergeReportID = 'concierge-123' ;
792+ await Onyx . set ( `${ ONYXKEYS . CONCIERGE_REPORT_ID } ` , conciergeReportID ) ;
793+
794+ const conciergeReport : Report = {
795+ reportID : conciergeReportID ,
796+ reportName : '' ,
797+ ownerAccountID : undefined ,
798+ participants : { } ,
799+ policyID : undefined ,
800+ chatType : undefined ,
801+ } ;
802+
803+ const result = getReportName ( conciergeReport ) ;
804+ expect ( result ) . toBe ( CONST . CONCIERGE_DISPLAY_NAME ) ;
805+ } ) ;
806+ } ) ;
807+
747808 describe ( 'Automatically approved report message via automatic (not by a human) action is' , ( ) => {
748809 test ( 'shown when the report is forwarded (Control feature)' , ( ) => {
749810 const expenseReport = {
0 commit comments