Skip to content

Commit a7a880f

Browse files
MelvinBotsituchan
andcommitted
Fix non-reimbursable badge test to actually validate the fix
The test used REIMBURSEMENT_NO which makes arePaymentsEnabled() return false, so canIOUBePaid never returns true regardless of the fix. Switch to REIMBURSEMENT_MANUAL with APPROVED status and correct report totals so canBePaidElsewhere returns true on main (without fix) but the non-reimbursable check in getBadgeFromIOUReport skips the PAY badge. Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
1 parent 2157dd0 commit a7a880f

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

tests/actions/IOUTest/ReportWorkflowTest.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3664,13 +3664,13 @@ describe('actions/IOU/ReportWorkflow', () => {
36643664
const chatReportID = '1401';
36653665
const policyID = '1402';
36663666

3667-
// REIMBURSEMENT_NO policy with no approval mode — submitted reports go straight to pay
36683667
const fakePolicy: Policy = {
36693668
...createRandomPolicy(Number(policyID)),
36703669
id: policyID,
36713670
type: CONST.POLICY.TYPE.TEAM,
3671+
approvalMode: CONST.POLICY.APPROVAL_MODE.BASIC,
36723672
role: CONST.POLICY.ROLE.ADMIN,
3673-
reimbursementChoice: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO,
3673+
reimbursementChoice: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL,
36743674
};
36753675

36763676
const fakeChatReport: Report = {
@@ -3679,20 +3679,19 @@ describe('actions/IOU/ReportWorkflow', () => {
36793679
policyID,
36803680
};
36813681

3682-
// Non-reimbursable-only report: total=0, nonReimbursableTotal=-5000
3683-
// canBePaidNow returns false (REIMBURSEMENT_NO early-exits when onlyShowPayElsewhere=false)
3684-
// canBePaidElsewhere returns true (SUBMITTED status + non-reimbursable spend)
3682+
// Non-reimbursable-only report: total and nonReimbursableTotal are equal.
3683+
// canBePaidElsewhere returns true (admin payer + isOnlyNonReimbursablePayElsewhere).
36853684
// But since all transactions are non-reimbursable, PAY badge should be skipped.
36863685
// Use a different managerID so canApproveIOU also returns false (current user is not the manager).
36873686
const fakeIouReport: Report = {
36883687
...createRandomReport(Number(iouReportID), CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT),
36893688
reportID: iouReportID,
36903689
type: CONST.REPORT.TYPE.EXPENSE,
36913690
policyID,
3692-
stateNum: CONST.REPORT.STATE_NUM.SUBMITTED,
3693-
statusNum: CONST.REPORT.STATUS_NUM.SUBMITTED,
3691+
stateNum: CONST.REPORT.STATE_NUM.APPROVED,
3692+
statusNum: CONST.REPORT.STATUS_NUM.APPROVED,
36943693
managerID: 999999,
3695-
total: 0,
3694+
total: -5000,
36963695
nonReimbursableTotal: -5000,
36973696
isWaitingOnBankAccount: false,
36983697
};

0 commit comments

Comments
 (0)