Skip to content

Commit 3e1957e

Browse files
authored
Merge pull request #1793 from CruGlobal/improve-pds-geo
No-Jira - quick preferential fix
2 parents 29a6e24 + eda06b7 commit 3e1957e

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

src/components/HrTools/PdsGoalCalculator/SupportItem/salaryBreakdown.test.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,28 @@ describe('buildSalaryBreakdownRows', () => {
9999
expect(byId['total']).toBeCloseTo(4680.0, 2);
100100
});
101101

102+
it('shows "Monthly Base" formula when geographic multiplier is 0', () => {
103+
const rows = buildSalaryBreakdownRows(
104+
salariedCalculation,
105+
{ ...constants, geographicMultiplier: 0 },
106+
'en-US',
107+
i18n.t,
108+
);
109+
const row = rows.find((r) => r.id === 'gross-monthly-pay');
110+
expect(row?.formula).toBe('Monthly Base');
111+
});
112+
113+
it('shows "Monthly Base × Geographic Multiplier (rate)" formula when multiplier is non-zero', () => {
114+
const rows = buildSalaryBreakdownRows(
115+
salariedCalculation,
116+
{ ...constants, geographicMultiplier: 0.06 },
117+
'en-US',
118+
i18n.t,
119+
);
120+
const row = rows.find((r) => r.id === 'gross-monthly-pay');
121+
expect(row?.formula).toBe('Monthly Base × Geographic Multiplier (106%)');
122+
});
123+
102124
it('inserts hours-per-week and monthly-base rows for hourly', () => {
103125
const rows = buildSalaryBreakdownRows(
104126
hourlyCalculation,

src/components/HrTools/PdsGoalCalculator/SupportItem/salaryBreakdown.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,12 @@ export const buildSalaryBreakdownRows = (
7676
{
7777
id: 'gross-monthly-pay',
7878
category: t('Gross Monthly Pay'),
79-
formula: t('Monthly Base × Geographic Multiplier ({{rate}})', {
80-
rate: percentageFormat(1 + geographicMultiplier, locale),
81-
}),
79+
formula:
80+
geographicMultiplier === 0
81+
? t('Monthly Base')
82+
: t('Monthly Base × Geographic Multiplier ({{rate}})', {
83+
rate: percentageFormat(1 + geographicMultiplier, locale),
84+
}),
8285
amount: grossMonthlyPay,
8386
format: 'currency',
8487
testId: 'gross-monthly-pay',

0 commit comments

Comments
 (0)