@@ -38,6 +38,7 @@ import {
3838 getApprovalChain ,
3939 getChatByParticipants ,
4040 getDefaultWorkspaceAvatar ,
41+ getDisplayNameForParticipant ,
4142 getDisplayNamesWithTooltips ,
4243 getGroupChatName ,
4344 getIconsForParticipants ,
@@ -110,7 +111,7 @@ import {
110111import createRandomTransaction from '../utils/collections/transaction' ;
111112import * as LHNTestUtils from '../utils/LHNTestUtils' ;
112113import { fakePersonalDetails } from '../utils/LHNTestUtils' ;
113- import { localeCompare } from '../utils/TestHelper' ;
114+ import { formatPhoneNumber , localeCompare } from '../utils/TestHelper' ;
114115import waitForBatchedUpdates from '../utils/waitForBatchedUpdates' ;
115116
116117// Be sure to include the mocked permissions library or else the beta tests won't work
@@ -3510,6 +3511,75 @@ describe('ReportUtils', () => {
35103511 } ) ;
35113512 } ) ;
35123513
3514+ describe ( 'getDisplayNameForParticipant' , ( ) => {
3515+ it ( 'should return the display name for a participant' , async ( ) => {
3516+ await Onyx . merge ( ONYXKEYS . PERSONAL_DETAILS_LIST , fakePersonalDetails ) ;
3517+
3518+ waitForBatchedUpdates ( ) ;
3519+
3520+ const policyExpenseChat : Report = {
3521+ ...createRandomReport ( 2 ) ,
3522+ chatType : CONST . REPORT . CHAT_TYPE . POLICY_EXPENSE_CHAT ,
3523+ policyID : policy . id ,
3524+ policyName : policy . name ,
3525+ type : CONST . REPORT . TYPE . CHAT ,
3526+ } ;
3527+
3528+ const lastReportPreviewAction = {
3529+ action : CONST . REPORT . ACTIONS . TYPE . REPORT_PREVIEW ,
3530+ actionName : CONST . REPORT . ACTIONS . TYPE . REPORT_PREVIEW ,
3531+ childReportName : 'Expense Report 2025-07-10' ,
3532+ childReportID : '5186125925096828' ,
3533+ created : '2025-07-10 17:45:31.448' ,
3534+ reportActionID : '7425617950691586420' ,
3535+ shouldShow : true ,
3536+ message : [
3537+ {
3538+ type : 'COMMENT' ,
3539+ html : 'a owes ETB 5.00' ,
3540+ text : 'a owes ETB 5.00' ,
3541+ isEdited : false ,
3542+ whisperedTo : [ ] ,
3543+ isDeletedParentAction : false ,
3544+ deleted : '' ,
3545+ reactions : [ ] ,
3546+ } ,
3547+ ] ,
3548+ originalMessage : {
3549+ linkedReportID : '5186125925096828' ,
3550+ actionableForAccountIDs : [ 20232605 ] ,
3551+ isNewDot : true ,
3552+ lastModified : '2025-07-10 17:45:53.635' ,
3553+ } ,
3554+ person : [
3555+ {
3556+ type : 'TEXT' ,
3557+ style : 'strong' ,
3558+ text : 'f100' ,
3559+ } ,
3560+ ] ,
3561+ parentReportID : policyExpenseChat . reportID ,
3562+ } ;
3563+
3564+ const iouReport = {
3565+ reportName : 'Expense Report 2025-07-10' ,
3566+ reportID : '5186125925096828' ,
3567+ policyID : policy . id ,
3568+ type : 'expense' ,
3569+ currency : 'ETB' ,
3570+ ownerAccountID : 1 ,
3571+ total : - 500 ,
3572+ nonReimbursableTotal : 0 ,
3573+ parentReportID : policyExpenseChat . reportID ,
3574+ parentReportActionID : lastReportPreviewAction . reportActionID ,
3575+ chatReportID : policyExpenseChat . reportID ,
3576+ } as Report ;
3577+
3578+ const displayName = getDisplayNameForParticipant ( { formatPhoneNumber, accountID : iouReport . ownerAccountID } ) ;
3579+ expect ( displayName ) . toBe ( fakePersonalDetails ?. [ 1 ] ?. displayName ) ;
3580+ } ) ;
3581+ } ) ;
3582+
35133583 describe ( 'isArchivedNonExpenseReport' , ( ) => {
35143584 // Given an expense report, a chat report, and an archived chat report
35153585 const expenseReport : Report = {
0 commit comments