Skip to content

Commit 34eb371

Browse files
committed
fix: typecheck
1 parent 5135c09 commit 34eb371

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/libs/actions/IOU/ReportWorkflow.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ import {getAllReportActionsFromIOU, getAllReportNameValuePairs, getAllTransactio
6767

6868
type ApproveMoneyRequestFunctionParams = {
6969
expenseReport: OnyxEntry<OnyxTypes.Report>;
70+
expenseReportPolicy: OnyxEntry<OnyxTypes.Policy>;
7071
policy: OnyxEntry<OnyxTypes.Policy>;
7172
currentUserAccountIDParam: number;
7273
currentUserEmailParam: string;
@@ -326,12 +327,13 @@ function approveMoneyRequest(params: ApproveMoneyRequestFunctionParams) {
326327
onApproved,
327328
ownerBillingGracePeriodEnd,
328329
delegateEmail,
330+
expenseReportPolicy,
329331
} = params;
330332
if (!expenseReport) {
331333
return;
332334
}
333335

334-
if (expenseReport.policyID && shouldRestrictUserBillableActions(expenseReport.policyID, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)) {
336+
if (expenseReport.policyID && shouldRestrictUserBillableActions(expenseReport.policyID, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed, expenseReportPolicy)) {
335337
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(expenseReport.policyID));
336338
return;
337339
}

tests/actions/IOUTest/ReportWorkflowTest.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,7 @@ describe('actions/IOU/ReportWorkflow', () => {
13301330

13311331
approveMoneyRequest({
13321332
expenseReport,
1333+
expenseReportPolicy: createRandomPolicy(Number(expenseReport.policyID)),
13331334
policy: {} as Policy,
13341335
currentUserAccountIDParam: CARLOS_ACCOUNT_ID,
13351336
currentUserEmailParam: CARLOS_EMAIL,
@@ -1366,6 +1367,7 @@ describe('actions/IOU/ReportWorkflow', () => {
13661367

13671368
approveMoneyRequest({
13681369
expenseReport,
1370+
expenseReportPolicy: createRandomPolicy(Number(expenseReport.policyID)),
13691371
policy: {} as Policy,
13701372
currentUserAccountIDParam: CARLOS_ACCOUNT_ID,
13711373
currentUserEmailParam: CARLOS_EMAIL,
@@ -1943,6 +1945,7 @@ describe('actions/IOU/ReportWorkflow', () => {
19431945
// Admin approves the report
19441946
approveMoneyRequest({
19451947
expenseReport,
1948+
expenseReportPolicy: policy,
19461949
policy,
19471950
currentUserAccountIDParam: adminAccountID,
19481951
currentUserEmailParam: adminEmail,
@@ -1994,6 +1997,7 @@ describe('actions/IOU/ReportWorkflow', () => {
19941997
// Manager approves the report
19951998
approveMoneyRequest({
19961999
expenseReport,
2000+
expenseReportPolicy: policy,
19972001
policy,
19982002
currentUserAccountIDParam: managerAccountID,
19992003
currentUserEmailParam: managerEmail,
@@ -2041,6 +2045,7 @@ describe('actions/IOU/ReportWorkflow', () => {
20412045
// Admin approves the report
20422046
approveMoneyRequest({
20432047
expenseReport,
2048+
expenseReportPolicy: policy,
20442049
policy,
20452050
currentUserAccountIDParam: adminAccountID,
20462051
currentUserEmailParam: adminEmail,
@@ -2164,6 +2169,7 @@ describe('actions/IOU/ReportWorkflow', () => {
21642169
// Manager approves the report (no take control actions)
21652170
approveMoneyRequest({
21662171
expenseReport,
2172+
expenseReportPolicy: policy,
21672173
policy,
21682174
currentUserAccountIDParam: managerAccountID,
21692175
currentUserEmailParam: managerEmail,
@@ -2194,6 +2200,7 @@ describe('actions/IOU/ReportWorkflow', () => {
21942200

21952201
approveMoneyRequest({
21962202
expenseReport,
2203+
expenseReportPolicy: policy,
21972204
policy,
21982205
currentUserAccountIDParam: managerAccountID,
21992206
currentUserEmailParam: managerEmail,
@@ -2222,6 +2229,7 @@ describe('actions/IOU/ReportWorkflow', () => {
22222229

22232230
approveMoneyRequest({
22242231
expenseReport: updatedReport,
2232+
expenseReportPolicy: policy,
22252233
policy,
22262234
currentUserAccountIDParam: adminAccountID,
22272235
currentUserEmailParam: adminEmail,
@@ -2280,6 +2288,7 @@ describe('actions/IOU/ReportWorkflow', () => {
22802288
// Manager approves the report
22812289
approveMoneyRequest({
22822290
expenseReport: singleApproverReport,
2291+
expenseReportPolicy: singleApproverPolicy,
22832292
policy: singleApproverPolicy,
22842293
currentUserAccountIDParam: managerAccountID,
22852294
currentUserEmailParam: managerEmail,
@@ -2394,6 +2403,7 @@ describe('actions/IOU/ReportWorkflow', () => {
23942403

23952404
const newExpenseReportID = approveMoneyRequest({
23962405
expenseReport,
2406+
expenseReportPolicy: policy,
23972407
policy,
23982408
currentUserAccountIDParam: adminAccountID,
23992409
currentUserEmailParam: adminEmail,

0 commit comments

Comments
 (0)