From ae8b1cc3c48a48ef52e9e6cc88d42890ff3291c6 Mon Sep 17 00:00:00 2001 From: "Alberto Gonzalez-Cela (via MelvinBot)" Date: Wed, 17 Jun 2026 13:59:21 +0000 Subject: [PATCH] Fix flaky createOwnedPaidPoliciesCountsSelector tests Pin pendingAction on policies expected to be counted as active so the random pendingAction from createRandomPolicy can no longer assign DELETE and make an otherwise-active policy count as pending deletion. Co-authored-by: Alberto Gonzalez-Cela --- tests/unit/selectors/PolicyTest.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/selectors/PolicyTest.ts b/tests/unit/selectors/PolicyTest.ts index da804d4a60bf..53fef58b441f 100644 --- a/tests/unit/selectors/PolicyTest.ts +++ b/tests/unit/selectors/PolicyTest.ts @@ -36,8 +36,8 @@ describe('createOwnedPaidPoliciesCountsSelector', () => { it('counts only paid policies owned by the user', () => { const policies: OnyxCollection = { - policy1: {...createRandomPolicy(OWNER_ACCOUNT_ID, CONST.POLICY.TYPE.TEAM)}, - policy2: {...createRandomPolicy(OWNER_ACCOUNT_ID, CONST.POLICY.TYPE.CORPORATE)}, + policy1: {...createRandomPolicy(OWNER_ACCOUNT_ID, CONST.POLICY.TYPE.TEAM), pendingAction: null}, + policy2: {...createRandomPolicy(OWNER_ACCOUNT_ID, CONST.POLICY.TYPE.CORPORATE), pendingAction: null}, policy3: {...createRandomPolicy(OWNER_ACCOUNT_ID, CONST.POLICY.TYPE.PERSONAL)}, policy4: {...createRandomPolicy(2, CONST.POLICY.TYPE.TEAM)}, }; @@ -47,7 +47,7 @@ describe('createOwnedPaidPoliciesCountsSelector', () => { it('excludes policies pending deletion from active count but includes them in total', () => { const policies: OnyxCollection = { - policy1: {...createRandomPolicy(OWNER_ACCOUNT_ID, CONST.POLICY.TYPE.TEAM)}, + policy1: {...createRandomPolicy(OWNER_ACCOUNT_ID, CONST.POLICY.TYPE.TEAM), pendingAction: null}, policy2: {...createRandomPolicy(OWNER_ACCOUNT_ID, CONST.POLICY.TYPE.CORPORATE), pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE}, }; const selector = createOwnedPaidPoliciesCountsSelector(OWNER_ACCOUNT_ID);