Skip to content

Commit

Permalink
Merge pull request #313 from DTS-STN/develop
Browse files Browse the repository at this point in the history
Release 2022-06-27b
  • Loading branch information
JeremyKennedy authored Jun 27, 2022
2 parents 3fd054e + f63d86f commit a37ae7e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 8 deletions.
22 changes: 22 additions & 0 deletions __tests__/pages/api/benefits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,28 @@ describe('consolidated benefit tests: eligible: 65+', () => {
expectAlwAfsTooOld(res)
})

it('returns "eligible" - single, 20 years in Canada, high income (partial gis edge case)', async () => {
const res = await mockGetRequest({
incomeAvailable: true,
income: 100000,
...age65NoDefer,
maritalStatus: MaritalStatus.SINGLE,
livingCountry: LivingCountry.CANADA,
legalStatus: LegalStatus.CANADIAN_CITIZEN,
livedOutsideCanada: true,
yearsInCanadaSince18: 20,
everLivedSocialCountry: undefined,
...partnerUndefined,
})
expectOasGisEligible(
res,
EntitlementResultType.PARTIAL,
roundToTwo(legalValues.oas.amount / 2),
324.34
)
expectAlwAfsTooOld(res)
})

it('returns "eligible" - single, living in Agreement, 20 years in Canada', async () => {
const res = await mockGetRequest({
...income10k,
Expand Down
2 changes: 1 addition & 1 deletion i18n/api/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,6 @@ const en: Translations = {
},
yes: 'Yes',
no: 'No',
years: 'years',
year: 'year',
}
export default en
2 changes: 1 addition & 1 deletion i18n/api/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,6 @@ const fr: Translations = {
},
yes: 'Oui',
no: 'Non',
years: 'ans',
year: 'an',
}
export default fr
2 changes: 1 addition & 1 deletion i18n/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export interface Translations {
}
yes: string
no: string
years: string
year: string
}

export function getTranslations(language: Language): Translations {
Expand Down
3 changes: 2 additions & 1 deletion utils/api/benefits/entitlementFormula.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,10 @@ export class EntitlementFormula {
this.calculationMethod === 'LOW'
? 3
: 1
return roundToTwo(
const calculated = roundToTwo(
this.actualMaxAmount - this.incomeDifferential * differentialMultiplier
)
return Math.max(0, calculated)
}

/**
Expand Down
10 changes: 6 additions & 4 deletions utils/api/definitions/textReplacementRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ export const textReplacementRules: TextReplacementRules = {
handler.benefitResults.oas?.entitlement.deferral.increase ?? 0,
handler.translations._locale
)}</strong>`,
OAS_DEFERRAL_YEARS: (handler) =>
`<strong>${String(
handler.benefitResults.oas?.entitlement.deferral.years ?? 0
)} ${handler.translations.years}</strong>`,
OAS_DEFERRAL_YEARS: (handler) => {
const years = handler.benefitResults.oas?.entitlement.deferral.years
return `<strong>${years ?? 0} ${handler.translations.year}${
years !== 1 ? 's' : ''
}</strong>`
},
OAS_DEFERRAL_AGE: (handler) =>
String(handler.benefitResults.oas.entitlement.deferral.age),
OAS_CLAWBACK: (handler) =>
Expand Down

1 comment on commit a37ae7e

@vercel
Copy link

@vercel vercel bot commented on a37ae7e Jun 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.