Skip to content

Commit

Permalink
Fix Fica test is skipping 100% of the time (#1137)
Browse files Browse the repository at this point in the history
* Mark test that isn't running

* Change the maximum arbitrary social security witholding.

The previous code used a very large number (10,000,000) as the
maximum possible amount of social security tax withheld, however
this is not possible as in real life the amount should be less
than $8500. Because of this large mismatch the test was being
skipped 100% of the time.

This fix creates a new arbitrary maximum of 10,000 which is much
closer to the range of real values and now allows the test to run

Co-authored-by: Connor Skennerton <c.skennerton@gmail.com>
  • Loading branch information
zakpatterson and ctSkennerton committed May 16, 2022
1 parent 5994703 commit 0375fe8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/tests/arbitraries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const investmentResult = posNegCurrency(100000)
const expense: Arbitrary<number> = posCurrency(10000)
const interest: Arbitrary<number> = posCurrency(10000)
const payment: Arbitrary<number> = fc.nat({ max: 100000 })
const ssWitholding: Arbitrary<number> = fc.nat({ max: 10000 })

const payerName: Arbitrary<string> = maxWords(3)

Expand Down Expand Up @@ -111,7 +112,7 @@ const w2: Arbitrary<types.IncomeW2> = wages.chain((income) =>
fc.nat({ max: 2 * income }),
fc.nat({ max: income }),
fc.nat({ max: income }),
fc.nat({ max: income }),
ssWitholding,
fc.nat({ max: income }),
employer,
w2Box12Info(income),
Expand Down
3 changes: 3 additions & 0 deletions src/forms/Y2021/tests/fica.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { claimableExcessSSTaxWithholding } from 'ustaxes/forms/Y2021/irsForms/Sc
import { displayRound } from 'ustaxes/core/irsForms/util'
import { testKit, commonTests } from '.'
import { PersonRole } from 'ustaxes/core/data'
import * as fc from 'fast-check'

jest.setTimeout(100000)

Expand Down Expand Up @@ -92,6 +93,8 @@ describe('fica', () => {
.reduce((l, r) => l + r, 0)

expect(ssRefund).toEqual(ssWithheld - fica.maxSSTax)
} else {
fc.pre(false)
}
return Promise.resolve()
})
Expand Down

0 comments on commit 0375fe8

Please sign in to comment.