Skip to content

Commit 5b6683b

Browse files
authored
Merge pull request Expensify#68522 from ryntgh/issue-68366
Fix: Out-of-pocket and company spend not seen automatically if adding unreported expense
2 parents 11ef858 + a7be7ca commit 5b6683b

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/actions/IOUTest.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6608,6 +6608,7 @@ describe('actions/IOU', () => {
66086608
let updatedTransaction: OnyxEntry<Transaction>;
66096609
let updatedIOUReportActionOnSelfDMReport: OnyxEntry<ReportAction>;
66106610
let updatedTrackExpenseActionableWhisper: OnyxEntry<ReportAction>;
6611+
let updatedExpenseReport: OnyxEntry<Report>;
66116612

66126613
await getOnyxData({
66136614
key: ONYXKEYS.COLLECTION.TRANSACTION,
@@ -6630,9 +6631,20 @@ describe('actions/IOU', () => {
66306631
},
66316632
});
66326633

6634+
await getOnyxData({
6635+
key: ONYXKEYS.COLLECTION.REPORT,
6636+
waitForCollectionCallback: true,
6637+
callback: (allReports) => {
6638+
updatedExpenseReport = Object.values(allReports ?? {}).find((r) => r?.reportID === expenseReport?.reportID);
6639+
},
6640+
});
6641+
66336642
expect(updatedTransaction?.reportID).toBe(expenseReport?.reportID);
66346643
expect(isMoneyRequestAction(updatedIOUReportActionOnSelfDMReport) ? getOriginalMessage(updatedIOUReportActionOnSelfDMReport)?.IOUTransactionID : undefined).toBe(undefined);
66356644
expect(updatedTrackExpenseActionableWhisper).toBe(undefined);
6645+
expect(updatedExpenseReport?.nonReimbursableTotal).toBe(-amount);
6646+
expect(updatedExpenseReport?.total).toBe(-amount);
6647+
expect(updatedExpenseReport?.unheldNonReimbursableTotal).toBe(-amount);
66366648
});
66376649

66386650
describe('saveSplitTransactions', () => {

0 commit comments

Comments
 (0)