@@ -44,6 +44,7 @@ import {
4444 getInvoiceChatByParticipants ,
4545 getMoneyReportPreviewName ,
4646 getMostRecentlyVisitedReport ,
47+ getParentNavigationSubtitle ,
4748 getParticipantsList ,
4849 getPolicyExpenseChat ,
4950 getReasonAndReportActionThatRequiresAttention ,
@@ -921,6 +922,48 @@ describe('ReportUtils', () => {
921922 } ) ;
922923 } ) ;
923924
925+ describe ( 'getParentNavigationSubtitle' , ( ) => {
926+ const baseArchivedPolicyExpenseChat = {
927+ reportID : '2' ,
928+ lastReadTime : '2024-02-01 04:56:47.233' ,
929+ parentReportActionID : '1' ,
930+ parentReportID : '1' ,
931+ reportName : 'Base Report' ,
932+ type : CONST . REPORT . TYPE . INVOICE ,
933+ } ;
934+
935+ const reports : Report [ ] = [
936+ {
937+ reportID : '1' ,
938+ lastReadTime : '2024-02-01 04:56:47.233' ,
939+ reportName : 'Report' ,
940+ policyName : 'A workspace' ,
941+ invoiceReceiver : { type : CONST . REPORT . INVOICE_RECEIVER_TYPE . INDIVIDUAL , accountID : 1 } ,
942+ } ,
943+ baseArchivedPolicyExpenseChat ,
944+ ] ;
945+
946+ beforeAll ( ( ) => {
947+ const reportCollectionDataSet = toCollectionDataSet ( ONYXKEYS . COLLECTION . REPORT , reports , ( report ) => report . reportID ) ;
948+ Onyx . multiSet ( {
949+ ...reportCollectionDataSet ,
950+ } ) ;
951+ return waitForBatchedUpdates ( ) ;
952+ } ) ;
953+
954+ it ( 'should return the correct parent navigation subtitle for the archived invoice report' , ( ) => {
955+ const actual = getParentNavigationSubtitle ( baseArchivedPolicyExpenseChat , true ) ;
956+ const normalizedActual = { ...actual , reportName : actual . reportName ?. replace ( / \u00A0 / g, ' ' ) } ;
957+ expect ( normalizedActual ) . toEqual ( { reportName : 'A workspace & Ragnar Lothbrok (archived)' } ) ;
958+ } ) ;
959+
960+ it ( 'should return the correct parent navigation subtitle for the non archived invoice report' , ( ) => {
961+ const actual = getParentNavigationSubtitle ( baseArchivedPolicyExpenseChat , false ) ;
962+ const normalizedActual = { ...actual , reportName : actual . reportName ?. replace ( / \u00A0 / g, ' ' ) } ;
963+ expect ( normalizedActual ) . toEqual ( { reportName : 'A workspace & Ragnar Lothbrok' } ) ;
964+ } ) ;
965+ } ) ;
966+
924967 describe ( 'requiresAttentionFromCurrentUser' , ( ) => {
925968 afterEach ( async ( ) => {
926969 await Onyx . clear ( ) ;
0 commit comments