-
Notifications
You must be signed in to change notification settings - Fork 1
No-Jira - PDS Goal Calculator: Quick Geographic Location fix #1793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,6 +99,28 @@ | |
| expect(byId['total']).toBeCloseTo(4680.0, 2); | ||
| }); | ||
|
|
||
| it('shows "Monthly Base" formula when geographic multiplier is 0', () => { | ||
| const rows = buildSalaryBreakdownRows( | ||
| salariedCalculation, | ||
| { ...constants, geographicMultiplier: 0 }, | ||
| 'en-US', | ||
| i18n.t, | ||
| ); | ||
| const row = rows.find((r) => r.id === 'gross-monthly-pay'); | ||
| expect(row?.formula).toBe('Monthly Base'); | ||
| }); | ||
|
Check warning on line 111 in src/components/HrTools/PdsGoalCalculator/SupportItem/salaryBreakdown.test.tsx
|
||
|
|
||
| it('shows "Monthly Base × Geographic Multiplier (rate)" formula when multiplier is non-zero', () => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[Suggestion] The non-zero branch is covered with `0.06`. If negative multipliers are reachable from `goalGeographicConstantMap` (sub-baseline cost-of-living regions), a negative test case would document the intended behavior (e.g. `-0.06` → `94%`). Skip if negative values aren't possible in practice.
|
||
| const rows = buildSalaryBreakdownRows( | ||
| salariedCalculation, | ||
| { ...constants, geographicMultiplier: 0.06 }, | ||
| 'en-US', | ||
| i18n.t, | ||
| ); | ||
| const row = rows.find((r) => r.id === 'gross-monthly-pay'); | ||
| expect(row?.formula).toBe('Monthly Base × Geographic Multiplier (106%)'); | ||
| }); | ||
|
|
||
| it('inserts hours-per-week and monthly-base rows for hourly', () => { | ||
| const rows = buildSalaryBreakdownRows( | ||
| hourlyCalculation, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,9 +76,12 @@ export const buildSalaryBreakdownRows = ( | |
| { | ||
| id: 'gross-monthly-pay', | ||
| category: t('Gross Monthly Pay'), | ||
| formula: t('Monthly Base × Geographic Multiplier ({{rate}})', { | ||
| rate: percentageFormat(1 + geographicMultiplier, locale), | ||
| }), | ||
| formula: | ||
| geographicMultiplier === 0 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[Suggestion] The strict `=== 0` guard is correct given that `geographicMultiplier` comes from `goalGeographicConstantMap` with `?? 0` (only exact zero is the "no adjustment" sentinel). Worth a brief comment to document this assumption so a future reader doesn't wonder whether very small values (e.g. `0.0001`) should also render "Monthly Base".
|
||
| ? t('Monthly Base') | ||
| : t('Monthly Base × Geographic Multiplier ({{rate}})', { | ||
| rate: percentageFormat(1 + geographicMultiplier, locale), | ||
| }), | ||
| amount: grossMonthlyPay, | ||
| format: 'currency', | ||
| testId: 'gross-monthly-pay', | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not blocking — just strengthens the invariant.