diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index a230549eb1af..431b5ebfb417 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -462,7 +462,7 @@ function needsToBeManuallySubmitted(report: OnyxTypes.Report) { /** * Return the object to update hasOutstandingChildRequest */ -function hasOutstandingChildRequest(report: OnyxTypes.Report, policy: OnyxEntry | EmptyObject): boolean { +function hasOutstandingChildRequest(report: OnyxTypes.Report): boolean { if (needsToBeManuallySubmitted(report)) { return true; } @@ -510,7 +510,7 @@ function buildOnyxDataForMoneyRequest( lastReadTime: DateUtils.getDBTime(), lastMessageTranslationKey: '', iouReportID: iouReport.reportID, - hasOutstandingChildRequest: hasOutstandingChildRequest(iouReport, policy ?? {}), + hasOutstandingChildRequest: hasOutstandingChildRequest(iouReport), ...(isNewChatReport ? {pendingFields: {createChat: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD}} : {}), }, }); diff --git a/tests/actions/IOUTest.ts b/tests/actions/IOUTest.ts index 3326d99a8a7f..c05e98a9b492 100644 --- a/tests/actions/IOUTest.ts +++ b/tests/actions/IOUTest.ts @@ -3308,7 +3308,7 @@ describe('actions/IOU', () => { policyID: policy.id, }; await Onyx.set(`${ONYXKEYS.COLLECTION.POLICY}${policy.id}`, policy); - expect(IOU.hasOutstandingChildRequest(report, policy)).toBe(true); + expect(IOU.hasOutstandingChildRequest(report)).toBe(true); }); it('should return false if an expense report does not need to be manually submitted', async () => { const policy = { @@ -3321,7 +3321,7 @@ describe('actions/IOU', () => { policyID: policy.id, }; await Onyx.set(`${ONYXKEYS.COLLECTION.POLICY}${policy.id}`, policy); - expect(IOU.hasOutstandingChildRequest(report, policy)).toBe(false); + expect(IOU.hasOutstandingChildRequest(report)).toBe(false); }); it('should return false for an IOU report where no money is owed', async () => { const report = { @@ -3334,7 +3334,7 @@ describe('actions/IOU', () => { email: RORY_EMAIL, accountID: RORY_ACCOUNT_ID, }); - expect(IOU.hasOutstandingChildRequest(report, {})).toBe(false); + expect(IOU.hasOutstandingChildRequest(report)).toBe(false); }); it('should return true for an IOU report where money is owed and the current user is the manager', async () => { const report = { @@ -3347,7 +3347,7 @@ describe('actions/IOU', () => { email: RORY_EMAIL, accountID: RORY_ACCOUNT_ID, }); - expect(IOU.hasOutstandingChildRequest(report, {})).toBe(true); + expect(IOU.hasOutstandingChildRequest(report)).toBe(true); }); it('should return false for an IOU report where money is owed but the current user is not the manager', async () => { const report = { @@ -3359,7 +3359,7 @@ describe('actions/IOU', () => { email: RORY_EMAIL, accountID: RORY_ACCOUNT_ID, }); - expect(IOU.hasOutstandingChildRequest(report, {})).toBe(false); + expect(IOU.hasOutstandingChildRequest(report)).toBe(false); }); }); });