Skip to content

Commit 5da2ba3

Browse files
authored
Merge pull request Expensify#74970 from Expensify/rodrigo-gbr-test-approver
[NO QA] Add GBR tests for approver only
2 parents e6b74e8 + 396b6b4 commit 5da2ba3

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/unit/ReportUtilsTest.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,6 +2345,33 @@ describe('ReportUtils', () => {
23452345
expect(requiresAttentionFromCurrentUser(report)).toBe(false);
23462346
expect(requiresAttentionFromCurrentUser(policyExpenseChat)).toBe(true);
23472347
});
2348+
2349+
it('returns false and does not surface GBR when expense report is approved and reimbursement is enabled', async () => {
2350+
// Given a policy with reimbursement enabled
2351+
const policyID = '1';
2352+
// And an expense report that is already approved
2353+
const report: Report = {
2354+
...LHNTestUtils.getFakeReport(),
2355+
type: CONST.REPORT.TYPE.EXPENSE,
2356+
stateNum: CONST.REPORT.STATE_NUM.APPROVED,
2357+
statusNum: CONST.REPORT.STATUS_NUM.APPROVED,
2358+
managerID: currentUserAccountID,
2359+
hasParentAccess: false,
2360+
policyID,
2361+
};
2362+
2363+
await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {
2364+
id: policyID,
2365+
reimbursementChoice: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL,
2366+
});
2367+
await waitForBatchedUpdates();
2368+
2369+
// When we evaluate if the report requires attention from the current user
2370+
const requiresAttention = requiresAttentionFromCurrentUser(report);
2371+
2372+
// Then it should return false because the report is already approved and reimbursement is enabled
2373+
expect(requiresAttention).toBe(false);
2374+
});
23482375
});
23492376

23502377
describe('getChatRoomSubtitle', () => {

0 commit comments

Comments
 (0)