Skip to content

Commit 07b911e

Browse files
committed
only apply for track expense
1 parent 995076f commit 07b911e

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

tests/unit/canEditFieldOfMoneyRequestTest.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,20 @@ describe('canEditFieldOfMoneyRequest', () => {
103103
return waitForBatchedUpdates();
104104
});
105105

106-
// Then the user should be able to move the invoice to the outstanding expense report
107-
it('should return true for invoice report action given that there is a minimum of one outstanding report', async () => {
106+
it('should return false for invoice report action if it is not outstanding report', async () => {
108107
const outstandingReportsByPolicyID = await OnyxUtils.get(ONYXKEYS.DERIVED.OUTSTANDING_REPORTS_BY_POLICY_ID);
109108

110109
const canEditReportField = canEditFieldOfMoneyRequest(reportAction, CONST.EDIT_REQUEST_FIELD.REPORT, undefined, undefined, outstandingReportsByPolicyID);
110+
expect(canEditReportField).toBe(false);
111+
});
112+
113+
it('should return true for invoice report action when there are outstanding reports', async () => {
114+
await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${IOUReportID}`, outstandingExpenseReport);
115+
await waitForBatchedUpdates();
116+
const outstandingReportsByPolicyID = await OnyxUtils.get(ONYXKEYS.DERIVED.OUTSTANDING_REPORTS_BY_POLICY_ID);
117+
118+
const canEditReportField = canEditFieldOfMoneyRequest(reportAction, CONST.EDIT_REQUEST_FIELD.REPORT, undefined, undefined, outstandingReportsByPolicyID);
119+
111120
expect(canEditReportField).toBe(true);
112121
});
113122
});

0 commit comments

Comments
 (0)