The golden suite
Public test cases
36 cases, 96 assertions. This exact list runs on every deploy
(node src/tools.test.mjs); a single failure blocks publication. The first case of each
tool is that page's server-rendered default.
payRaise() — 4 cases
| Input | Expected (all passing) |
|---|---|
| {"amount": 52000, "basis": "year", "raise": 4, "mode": "pct"} | newAnnual = 54080 · newHourly = 26 · newMonthly = 4506.67 · perBiweekly = 80 ✓ |
| {"amount": 25, "basis": "hour", "raise": 1, "mode": "amt"} | annual = 52000 · delta = 2080 · newAnnual = 54080 · perBiweekly = 80 ✓ |
| {"amount": 60000, "basis": "year", "raise": 7.5, "mode": "pct"} | newAnnual = 64500 · newHourly = 31.01 · newMonthly = 5375 · perBiweekly = 173.08 ✓ |
| {"amount": 0, "basis": "year", "raise": 10, "mode": "pct"} | newAnnual = 0 · perBiweekly = 0 ✓ |
overtime() — 4 cases
| Input | Expected (all passing) |
|---|---|
| {"rate": 22, "totalHours": 48} | regPay = 880 · otHours = 8 · otRate = 33 · otPay = 264 · total = 1144 ✓ |
| {"rate": 18.5, "totalHours": 40} | otHours = 0 · otPay = 0 · total = 740 ✓ |
| {"rate": 30, "totalHours": 52.5} | otHours = 12.5 · otRate = 45 · otPay = 562.5 · total = 1762.5 ✓ |
| {"rate": 16, "totalHours": 36} | regHours = 36 · total = 576 ✓ |
timeAndAHalf() — 4 cases
| Input | Expected (all passing) |
|---|---|
| {"rate": 20, "hours": 8} | otRate = 30 · pay = 240 · doubleRate = 40 ✓ |
| {"rate": 15, "hours": 0} | otRate = 22.5 · pay = 0 ✓ |
| {"rate": 33.33, "hours": 4} | otRate = 50 · pay = 199.98 ✓ |
| {"rate": 7.25, "hours": 10} | otRate = 10.88 · pay = 108.75 ✓ |
timeToDecimal() — 5 cases
| Input | Expected (all passing) |
|---|---|
| {"hours": 7, "minutes": 45, "rate": 18} | decimal = 7.75 · exact = 7.75 · pay = 139.5 ✓ |
| {"hours": 7, "minutes": 20} | decimal = 7.33 · exact = 7.3333 ✓ |
| {"hours": 0, "minutes": 1} | decimal = 0.02 · minutesDecimal = 0.0167 ✓ |
| {"hours": 40, "minutes": 0} | decimal = 40 · exact = 40 ✓ |
| {"hours": 8, "minutes": 7, "rate": 25} | decimal = 8.12 · pay = 202.92 ✓ |
salaryHourly() — 4 cases
| Input | Expected (all passing) |
|---|---|
| {"amount": 60000, "basis": "year"} | hourly = 28.85 · weekly = 1153.85 · biweekly = 2307.69 · semimonthly = 2500 · monthly = 5000 ✓ |
| {"amount": 28.85, "basis": "hour"} | annual = 60008 ✓ |
| {"amount": 60000, "basis": "year", "weeksPerYear": 50} | hourly = 30 · weekly = 1200 ✓ |
| {"amount": 17.5, "basis": "hour", "hoursPerWeek": 30} | annual = 27300 · monthly = 2275 ✓ |
biweeklyPay() — 4 cases
| Input | Expected (all passing) |
|---|---|
| {"annual": 65000} | weekly = 1250 · biweekly = 2500 · semimonthly = 2708.33 · monthly = 5416.67 ✓ |
| {"annual": 52000} | biweekly = 2000 · semimonthly = 2166.67 ✓ |
| {"annual": 100000} | biweekly = 3846.15 · monthly = 8333.33 ✓ |
| {"annual": 0} | biweekly = 0 · weekly = 0 ✓ |
commission() — 4 cases
| Input | Expected (all passing) |
|---|---|
| {"sales": 85000, "rate": 0.04, "base": 1500} | commission = 3400 · effectiveRate = 0.04 · total = 4900 ✓ |
| {"sales": 120000, "tiers": [{"upTo": 50000, "rate": 0.03}, {"upTo": 100000, "rate": 0.05}, {"upTo": null, "rate": 0.08}]} | commission = 5600 · effectiveRate = 0.0467 ✓ |
| {"sales": 40000, "rate": 0.05, "draw": 2500} | commission = 2000 · afterDraw = 0 · drawShortfall = 500 · total = 0 ✓ |
| {"sales": 0, "rate": 0.06, "base": 2000} | commission = 0 · total = 2000 ✓ |
ptoPayout() — 3 cases
| Input | Expected (all passing) |
|---|---|
| {"hours": 64, "rate": 25} | gross = 1600 · fedFlatPreview = 352 · afterFedFlat = 1248 ✓ |
| {"hours": 40, "salary": 62400} | hourly = 30 · gross = 1200 ✓ |
| {"hours": 0, "rate": 50} | gross = 0 · fedFlatPreview = 0 ✓ |
severance() — 4 cases
| Input | Expected (all passing) |
|---|---|
| {"amount": 78000, "basis": "year", "weeksPerYear": 2, "years": 6} | weekly = 1500 · gross = 18000 · monthsCovered = 2.8 · fedFlatPreview = 3960 ✓ |
| {"amount": 1500, "basis": "week", "weeksPerYear": 1, "years": 10} | gross = 15000 ✓ |
| {"amount": 52000, "basis": "year", "weeksPerYear": 2, "years": 0.5} | weekly = 1000 · gross = 1000 ✓ |
| {"amount": 91000, "basis": "year", "weeksPerYear": 3, "years": 4} | weekly = 1750 · gross = 21000 · monthsCovered = 2.8 ✓ |
Found an input we get wrong? That's a bug in the suite's coverage, not a rounding quirk to shrug at — tell us and the failing case gets added here.