@@ -105,6 +105,7 @@ import {
105105 getTaskAssigneeChatOnyxData,
106106 getTransactionDetails,
107107 getTransactionSortValue,
108+ getUnreportedTransactionMessage,
108109 getViolatingReportIDForRBRInLHN,
109110 getWorkspaceIcon,
110111 getWorkspaceNameUpdatedMessage,
@@ -12878,6 +12879,85 @@ describe('ReportUtils', () => {
1287812879 });
1287912880 });
1288012881
12882+ describe('getUnreportedTransactionMessage', () => {
12883+ it('should return unreported transaction message when fromReportID is UNREPORTED_REPORT_ID', () => {
12884+ const action = {
12885+ ...LHNTestUtils.getFakeReportAction(),
12886+ actionName: CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION,
12887+ originalMessage: {
12888+ fromReportID: CONST.REPORT.UNREPORTED_REPORT_ID,
12889+ },
12890+ } as unknown as ReportAction;
12891+
12892+ const result = getUnreportedTransactionMessage(translateLocal, action, undefined);
12893+ expect(typeof result).toBe('string');
12894+ expect(result.length).toBeGreaterThan(0);
12895+ });
12896+
12897+ it('should return moved transaction message when fromReportID is a regular report', async () => {
12898+ const fromReport = LHNTestUtils.getFakeReport();
12899+ await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${fromReport.reportID}`, fromReport);
12900+
12901+ const action = {
12902+ ...LHNTestUtils.getFakeReportAction(),
12903+ actionName: CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION,
12904+ originalMessage: {
12905+ fromReportID: fromReport.reportID,
12906+ },
12907+ } as unknown as ReportAction;
12908+
12909+ const result = getUnreportedTransactionMessage(translateLocal, action, undefined);
12910+ expect(typeof result).toBe('string');
12911+ expect(result.length).toBeGreaterThan(0);
12912+ });
12913+
12914+ it('should pass conciergeReportID through to getReportName', async () => {
12915+ const fromReport = LHNTestUtils.getFakeReport();
12916+ await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${fromReport.reportID}`, fromReport);
12917+
12918+ const action = {
12919+ ...LHNTestUtils.getFakeReportAction(),
12920+ actionName: CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION,
12921+ originalMessage: {
12922+ fromReportID: fromReport.reportID,
12923+ },
12924+ } as unknown as ReportAction;
12925+
12926+ // Should not throw with or without conciergeReportID
12927+ const result1 = getUnreportedTransactionMessage(translateLocal, action, undefined);
12928+ const result2 = getUnreportedTransactionMessage(translateLocal, action, '99999');
12929+ expect(typeof result1).toBe('string');
12930+ expect(typeof result2).toBe('string');
12931+ });
12932+ });
12933+
12934+ describe('getReportName with conciergeReportID', () => {
12935+ it('should return Concierge display name when report is the concierge chat', async () => {
12936+ const conciergeReport: Report = {
12937+ reportID: '100',
12938+ participants: buildParticipantsFromAccountIDs([currentUserAccountID, CONST.ACCOUNT_ID.CONCIERGE]),
12939+ };
12940+ await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReport.reportID}`, conciergeReport);
12941+ await Onyx.merge(ONYXKEYS.CONCIERGE_REPORT_ID, conciergeReport.reportID);
12942+
12943+ // eslint-disable-next-line @typescript-eslint/no-deprecated
12944+ const name = getReportNameDeprecated({report: conciergeReport, conciergeReportID: conciergeReport.reportID});
12945+ expect(name).toBe(CONST.CONCIERGE_DISPLAY_NAME);
12946+ });
12947+
12948+ it('should not return Concierge display name when conciergeReportID does not match', async () => {
12949+ const regularReport: Report = {
12950+ reportID: '200',
12951+ participants: buildParticipantsFromAccountIDs([currentUserAccountID, 1]),
12952+ };
12953+ await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${regularReport.reportID}`, regularReport);
12954+
12955+ // eslint-disable-next-line @typescript-eslint/no-deprecated
12956+ const name = getReportNameDeprecated({report: regularReport, conciergeReportID: '999'});
12957+ expect(name).not.toBe(CONST.CONCIERGE_DISPLAY_NAME);
12958+ });
12959+ });
12960+
1288112961 describe('getAvailableReportFields', () => {
1288212962 const fieldList1 = {
1288312963 expensify_field_id_LIST: {
0 commit comments