Skip to content

Commit 3deb82f

Browse files
committed
update test data
1 parent 07dc9e8 commit 3deb82f

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

src/libs/ReportUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2707,7 +2707,7 @@ function canAddOrDeleteTransactions(moneyRequestReport: OnyxEntry<Report>, isRep
27072707
return false;
27082708
}
27092709

2710-
if (isProcessingReport(moneyRequestReport)) {
2710+
if (isProcessingReport(moneyRequestReport) && isExpenseReport(moneyRequestReport)) {
27112711
return isAwaitingFirstLevelApproval(moneyRequestReport);
27122712
}
27132713

tests/unit/ReportUtilsTest.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3000,7 +3000,7 @@ describe('ReportUtils', () => {
30003000
type: CONST.POLICY.TYPE.TEAM,
30013001
name: '',
30023002
role: 'user',
3003-
owner: '',
3003+
owner: currentUserEmail,
30043004
outputCurrency: '',
30053005
isPolicyExpenseChatEnabled: false,
30063006
};
@@ -3020,6 +3020,7 @@ describe('ReportUtils', () => {
30203020
parentReportID: '101',
30213021
policyID: paidPolicy.id,
30223022
ownerAccountID: currentUserAccountID,
3023+
managerID: currentUserAccountID,
30233024
};
30243025
const moneyRequestOptions = temporary_getMoneyRequestOptions(report, paidPolicy, [currentUserAccountID, participantsAccountIDs.at(0) ?? CONST.DEFAULT_NUMBER_ID]);
30253026
expect(moneyRequestOptions.length).toBe(2);
@@ -3734,13 +3735,26 @@ describe('ReportUtils', () => {
37343735
reportID: '1',
37353736
type: CONST.REPORT.TYPE.EXPENSE,
37363737
ownerAccountID: currentUserAccountID,
3738+
managerID: currentUserAccountID,
37373739
stateNum: CONST.REPORT.STATE_NUM.SUBMITTED,
37383740
statusNum: CONST.REPORT.STATUS_NUM.SUBMITTED,
37393741
participants: {
37403742
[currentUserAccountID]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS},
37413743
},
3744+
policyID: '11',
37423745
};
3743-
// Wait for Onyx to load session data before calling canDeleteMoneyRequestReport,
3746+
3747+
const expensseReportpolicy = {
3748+
id: '11',
3749+
employeeList: {
3750+
[currentUserEmail]: {
3751+
email: currentUserEmail,
3752+
submitsTo: currentUserEmail,
3753+
},
3754+
},
3755+
};
3756+
3757+
await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}11`, expensseReportpolicy); // Wait for Onyx to load session data before calling canDeleteMoneyRequestReport,
37443758
// since it relies on the session subscription for currentUserAccountID.
37453759
await new Promise<void>((resolve) => {
37463760
const connection = Onyx.connectWithoutView({
@@ -3751,6 +3765,7 @@ describe('ReportUtils', () => {
37513765
},
37523766
});
37533767
});
3768+
37543769
expect(canDeleteMoneyRequestReport(expenseReport, [], [])).toBe(true);
37553770
});
37563771
});

0 commit comments

Comments
 (0)