@@ -823,6 +823,67 @@ describe('ReportUtils', () => {
823823 } ) ;
824824 } ) ;
825825
826+ describe ( 'Fallback scenarios' , ( ) => {
827+ test ( 'should fallback to report.reportName when primary name generation returns empty string' , ( ) => {
828+ const reportWithFallbackName : Report = {
829+ reportID : '3' ,
830+ reportName : 'Custom Report Name' ,
831+ ownerAccountID : undefined ,
832+ participants : { } ,
833+ policyID : undefined ,
834+ chatType : undefined ,
835+ } ;
836+
837+ const result = getReportName ( reportWithFallbackName ) ;
838+ expect ( result ) . toBe ( 'Custom Report Name' ) ;
839+ } ) ;
840+
841+ test ( 'should return empty string when both primary name generation and reportName are empty' , ( ) => {
842+ const reportWithoutName : Report = {
843+ reportID : '4' ,
844+ reportName : '' ,
845+ ownerAccountID : undefined ,
846+ participants : { } ,
847+ policyID : undefined ,
848+ chatType : undefined ,
849+ } ;
850+
851+ const result = getReportName ( reportWithoutName ) ;
852+ expect ( result ) . toBe ( '' ) ;
853+ } ) ;
854+
855+ test ( 'should return empty string when reportName is undefined' , ( ) => {
856+ const reportWithUndefinedName : Report = {
857+ reportID : '5' ,
858+ reportName : undefined ,
859+ ownerAccountID : undefined ,
860+ participants : { } ,
861+ policyID : undefined ,
862+ chatType : undefined ,
863+ } ;
864+
865+ const result = getReportName ( reportWithUndefinedName ) ;
866+ expect ( result ) . toBe ( '' ) ;
867+ } ) ;
868+
869+ test ( 'should return Concierge display name for concierge chat report' , async ( ) => {
870+ const conciergeReportID = 'concierge-123' ;
871+ await Onyx . set ( `${ ONYXKEYS . CONCIERGE_REPORT_ID } ` , conciergeReportID ) ;
872+
873+ const conciergeReport : Report = {
874+ reportID : conciergeReportID ,
875+ reportName : '' ,
876+ ownerAccountID : undefined ,
877+ participants : { } ,
878+ policyID : undefined ,
879+ chatType : undefined ,
880+ } ;
881+
882+ const result = getReportName ( conciergeReport ) ;
883+ expect ( result ) . toBe ( CONST . CONCIERGE_DISPLAY_NAME ) ;
884+ } ) ;
885+ } ) ;
886+
826887 describe ( 'Automatically approved report message via automatic (not by a human) action is' , ( ) => {
827888 test ( 'shown when the report is forwarded (Control feature)' , ( ) => {
828889 const expenseReport = {
0 commit comments