Skip to content

Commit

Permalink
saving changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGoC committed Oct 9, 2024
1 parent fb4cef5 commit 6c1e4c5
Show file tree
Hide file tree
Showing 21 changed files with 349 additions and 40 deletions.
3 changes: 3 additions & 0 deletions __tests__/pages/api/benefits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ describe('consolidated benefit tests: ineligible', () => {
partnerIncomeWork: 0,
age: 50,
oasDefer: false,
whenToStartOAS: true, //asap
receiveOAS: false,
oasDeferDuration: undefined,
oasAge: undefined,
Expand Down Expand Up @@ -791,6 +792,7 @@ describe('consolidated benefit tests: eligible: 65+', () => {
partnerIncomeWork: 0,
age: 75,
oasDefer: false,
whenToStartOAS: true, //asap
receiveOAS: false,
oasDeferDuration: undefined,
oasAge: undefined,
Expand Down Expand Up @@ -973,6 +975,7 @@ describe('consolidated benefit tests: eligible: 60-64', () => {
age: 64,
oasDefer: false,
receiveOAS: false,
whenToStartOAS: true, //asap
oasDeferDuration: undefined,
oasAge: undefined,
maritalStatus: MaritalStatus.PARTNERED,
Expand Down
9 changes: 9 additions & 0 deletions __tests__/pages/api/field-reqs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('field requirement analysis', () => {
oasDefer: undefined,
oasAge: undefined,
receiveOAS: false,
whenToStartOAS: undefined, //asap
oasDeferDuration: undefined,
maritalStatus: undefined,
livingCountry: undefined,
Expand All @@ -39,6 +40,7 @@ describe('field requirement analysis', () => {
expect(res.body.summary.state).toEqual(SummaryState.MORE_INFO)
expect(res.body.missingFields).toEqual([
FieldKey.AGE,
FieldKey.WHEN_TO_START,
FieldKey.INCOME,
//FieldKey.INCOME_WORK,
FieldKey.LEGAL_STATUS,
Expand All @@ -48,6 +50,7 @@ describe('field requirement analysis', () => {
])
expect(res.body.visibleFields).toEqual([
FieldKey.AGE,
FieldKey.WHEN_TO_START,
FieldKey.INCOME,
FieldKey.INCOME_WORK,
FieldKey.LEGAL_STATUS,
Expand All @@ -66,6 +69,7 @@ describe('field requirement analysis', () => {
oasDefer: true,
oasAge: 70,
receiveOAS: false,
whenToStartOAS: true, //asap
oasDeferDuration: '{ "months": 0, "years": 5 }',
maritalStatus: MaritalStatus.PARTNERED,
...canadian,
Expand All @@ -87,6 +91,7 @@ describe('field requirement analysis', () => {
expect(res.body.visibleFields).toEqual([
FieldKey.AGE,
FieldKey.ALREADY_RECEIVE_OAS,
FieldKey.WHEN_TO_START,
FieldKey.OAS_AGE,
// FieldKey.INCOME_AVAILABLE,
FieldKey.INCOME,
Expand Down Expand Up @@ -119,6 +124,7 @@ describe('field requirements analysis: conditional fields', () => {
partnerIncomeWork: 0,
...age65NoDefer,
receiveOAS: false,
whenToStartOAS: true, //asap
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.SINGLE,
...canadian,
Expand All @@ -140,6 +146,7 @@ describe('field requirements analysis: conditional fields', () => {
partnerIncomeWork: 0,
...age65NoDefer,
receiveOAS: false,
whenToStartOAS: true, //asap
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.SINGLE,
...canadian,
Expand All @@ -161,6 +168,7 @@ describe('field requirements analysis: conditional fields', () => {
partnerIncomeWork: 0,
...age65NoDefer,
receiveOAS: false,
whenToStartOAS: true, //asap
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.SINGLE,
livingCountry: LivingCountry.NO_AGREEMENT,
Expand All @@ -183,6 +191,7 @@ describe('field requirements analysis: conditional fields', () => {
partnerIncomeWork: 0,
...age65NoDefer,
receiveOAS: false,
whenToStartOAS: true, //asap
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.PARTNERED,
...canadian,
Expand Down
5 changes: 5 additions & 0 deletions __tests__/pages/api/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ describe('basic Allowance scenarios', () => {
...income10k,
...age60NoDefer,
receiveOAS: false,
whenToStartOAS: true, //asap
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.PARTNERED,
invSeparated: false,
Expand Down Expand Up @@ -356,6 +357,7 @@ describe('basic Allowance for Survivor scenarios', () => {
...age65NoDefer,
incomeWork: 0,
receiveOAS: false,
whenToStartOAS: true, //asap
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.WIDOWED,
...canadian,
Expand All @@ -372,6 +374,7 @@ describe('basic Allowance for Survivor scenarios', () => {
...income10k,
...age65NoDefer,
receiveOAS: false,
whenToStartOAS: true, //asap
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.WIDOWED,
invSeparated: false,
Expand All @@ -394,6 +397,7 @@ describe('basic Allowance for Survivor scenarios', () => {
age: 59,
oasDefer: false,
receiveOAS: false,
whenToStartOAS: true, //asap
oasDeferDuration: undefined,
oasAge: undefined,
maritalStatus: MaritalStatus.WIDOWED,
Expand Down Expand Up @@ -438,6 +442,7 @@ describe('basic Allowance for Survivor scenarios', () => {
...income10k,
...age60NoDefer,
receiveOAS: false,
whenToStartOAS: true, //asap
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.PARTNERED,
invSeparated: false,
Expand Down
32 changes: 32 additions & 0 deletions __tests__/pages/api/july2013Deferral.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,4 +416,36 @@ describe('july2013Deferral', () => {
expectGisEligible(res, 0, true)
expectAlwTooOld(res, true)
})

/* CALC-187 */
it('should TEST TEST - CALC-187', async () => {
const desiredName = 'CALC-187'
const extractedPayload = getTransformedPayloadByName(filePath, desiredName)
const res = await mockGetRequest({
...extractedPayload,
maritalStatus: 'single',
invSeparated: 'false',
age: 55.0,
clientBirthDate: '1969;08',
yearsInCanadaSince18: '10',
income: 2000,
whenToStartOAS: false,
startDateForOAS: -10.08,
partnerBenefitStatus: undefined,
partnerIncome: 0,
partnerIncomeWork: 0,
partnerAge: undefined,
partnerBirthDate: undefined,
partnerLivingCountry: undefined,
partnerLegalStatus: undefined,
partnerLivedOnlyInCanada: undefined,
})

const future = res.body.futureClientResults[0][65]
console.log('#####', future)
expect(res.status).toEqual(400)
expect(res.body.summary.state).toEqual('AVAILABLE_INELIGIBLE')
expect(future.oas.eligibility.result).toEqual('eligible')
expect(future.oas.entitlement.result).toBeCloseTo(359.17, 0.01)
})
})
3 changes: 3 additions & 0 deletions __tests__/utils/expectUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ export const age65NoDefer = {
oasDefer: false,
oasAge: undefined,
receiveOAS: false,
whenToStartOAS: true, //asap
oasDeferDuration: undefined,
}

Expand All @@ -350,6 +351,7 @@ export const age75NoDefer = {
oasDefer: false,
oasAge: undefined,
receiveOAS: false,
whenToStartOAS: true, //asap
oasDeferDuration: undefined,
}

Expand All @@ -358,6 +360,7 @@ export const age60NoDefer = {
oasDefer: false,
oasAge: undefined,
receiveOAS: false,
whenToStartOAS: true, //asap
oasDeferDuration: undefined,
}

Expand Down
7 changes: 7 additions & 0 deletions components/QuestionsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ export const QuestionsPage: React.VFC = ({}) => {
setAgeDate(ageDate)
}

if (key === 'startDateForOAS') {
newVal = JSON.parse(newValue).value
// const oasStartDate = JSON.parse(newValue).date
// setDateToStartOAS(oasStartDate)
}

if (key === 'partnerAge') {
newVal = JSON.parse(newValue).value
}
Expand Down Expand Up @@ -228,6 +234,7 @@ export const QuestionsPage: React.VFC = ({}) => {
receiveOAS,
tsln
)

return (
<div key={field.key}>
<div className="pb-4" id={field.key}>
Expand Down
22 changes: 22 additions & 0 deletions i18n/api/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ const en: Translations = {
[FieldKey.AGE]: 'When were you born?',
[FieldKey.ALREADY_RECEIVE_OAS]:
'Do you already receive the Old Age Security pension?',
[FieldKey.WHEN_TO_START]:
'When do you want your Old Age Security pension to start?',
[FieldKey.START_DATE_FOR_OAS]: 'Enter start date',
[FieldKey.OAS_DEFER_DURATION]:
'How long did you defer your Old Age Security pension?',
[FieldKey.OAS_DEFER]:
Expand Down Expand Up @@ -85,6 +88,8 @@ const en: Translations = {
questionShortText: {
[FieldKey.AGE]: 'Age',
[FieldKey.ALREADY_RECEIVE_OAS]: 'Already receive OAS pension',
[FieldKey.WHEN_TO_START]: 'OAS pension start date',
[FieldKey.START_DATE_FOR_OAS]: 'Start date',
[FieldKey.OAS_DEFER]: 'OAS pension deferral',
[FieldKey.OAS_DEFER_DURATION]: 'Deferred OAS pension',
[FieldKey.OAS_AGE]: 'OAS pension deferral',
Expand Down Expand Up @@ -116,6 +121,9 @@ const en: Translations = {
[FieldKey.OAS_AGE]: 'Start at',
[FieldKey.ALREADY_RECEIVE_OAS]:
'Edit if you already receive the OAS pension',
[FieldKey.WHEN_TO_START]:
'When do you want your Old Age Security pension to start?',
[FieldKey.START_DATE_FOR_OAS]: 'Edit your start date',
[FieldKey.OAS_DEFER_DURATION]: 'Edit your OAS pension deferral',
[FieldKey.OAS_DEFER]: 'Edit your deferral decision',
[FieldKey.INCOME_AVAILABLE]: 'Edit if you will provide your income',
Expand Down Expand Up @@ -162,6 +170,8 @@ const en: Translations = {
'If you didn’t delay your payments, go to the next step.',
[FieldKey.OAS_DEFER]:
'If you already receive the OAS pension, enter when you started receiving it. {LINK_OAS_DEFER_INLINE}',
[FieldKey.WHEN_TO_START]:
"If you're eligible, you can start as early as the month after your 65th birthday",
[FieldKey.OAS_AGE]: 'This should be between 65 and 70.',
[FieldKey.YEARS_IN_CANADA_SINCE_18]:
'Do not include periods when you were outside Canada for at least 6 months at a time. Some exceptions apply, such as working for a Canadian employer abroad.',
Expand Down Expand Up @@ -207,6 +217,18 @@ const en: Translations = {
shortText: 'No',
},
],
[FieldKey.WHEN_TO_START]: [
{
key: true,
text: 'As soon as possible',
shortText: 'As soon as possible',
},
{
key: false,
text: 'As of a specific month',
shortText: 'As of a specific month',
},
],
[FieldKey.OAS_DEFER]: [
{
key: false,
Expand Down
22 changes: 22 additions & 0 deletions i18n/api/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ const fr: Translations = {
[FieldKey.AGE]: 'Quel est votre mois de naissance?',
[FieldKey.ALREADY_RECEIVE_OAS]:
'Recevez-vous la pension de la Sécurité de la vieillesse?',
[FieldKey.WHEN_TO_START]:
'Quand voulez-vous commencer à recevoir votre pension de la Sécurité de la vieillesse?',
[FieldKey.START_DATE_FOR_OAS]: 'Entrez une date de début',
[FieldKey.OAS_DEFER_DURATION]:
'Pendant combien de temps avez-vous reporté votre pension de la Sécurité de la vieillesse?',
[FieldKey.OAS_DEFER]:
Expand Down Expand Up @@ -88,6 +91,8 @@ const fr: Translations = {
questionShortText: {
[FieldKey.AGE]: 'Âge',
[FieldKey.ALREADY_RECEIVE_OAS]: 'Reçoit la pension de la SV',
[FieldKey.WHEN_TO_START]: 'Date de début de la pension SV',
[FieldKey.START_DATE_FOR_OAS]: 'date de début',
[FieldKey.OAS_DEFER]: 'Report de la pension de la SV',
[FieldKey.OAS_DEFER_DURATION]: 'Report de la pension de la SV',
[FieldKey.OAS_AGE]: 'Report de la pension de la\xA0SV',
Expand Down Expand Up @@ -120,6 +125,9 @@ const fr: Translations = {
[FieldKey.OAS_AGE]: 'Commencer à',
[FieldKey.ALREADY_RECEIVE_OAS]:
'Modifier si vous recevez la pension de la SV',
[FieldKey.WHEN_TO_START]:
'Modifier quand voulez-vous commencer à recevoir votre pension de la Sécurité de la vieillesse?',
[FieldKey.START_DATE_FOR_OAS]: 'Modifier votre date de début',
[FieldKey.OAS_DEFER]: 'Modifier votre décision de report',
[FieldKey.OAS_DEFER_DURATION]:
'Modifier le report de votre pension de la SV',
Expand Down Expand Up @@ -170,6 +178,8 @@ const fr: Translations = {
'<div>Si vous recevez déjà la pension de la SV, indiquez quand vous avez commencé à la recevoir. {LINK_OAS_DEFER_INLINE}</div>',
[FieldKey.OAS_DEFER_DURATION]:
"Si vous n'avez pas reporté votre pension, passez à l'étape suivante.",
[FieldKey.WHEN_TO_START]:
'Si vous êtes admissible, vous pouvez commencer dès le mois après votre 65e anniversaire.',
[FieldKey.OAS_AGE]: 'Ce nombre doit être entre 65 et 70.',
[FieldKey.YEARS_IN_CANADA_SINCE_18]:
"Ne comptez pas les périodes où vous étiez à l'extérieur du Canada pendant au moins 6 mois consécutifs. Certaines exceptions s'appliquent, comme travailler pour un employeur canadien à l'étranger.",
Expand Down Expand Up @@ -215,6 +225,18 @@ const fr: Translations = {
shortText: 'Non',
},
],
[FieldKey.WHEN_TO_START]: [
{
key: true,
text: 'As soon as possible',
shortText: 'As soon as possible',
},
{
key: false,
text: 'As of a specific month',
shortText: 'As of a specific month',
},
],
[FieldKey.OAS_DEFER]: [
{
key: false,
Expand Down
1 change: 1 addition & 0 deletions i18n/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface Translations {
questionOptions: {
[FieldKey.INCOME_AVAILABLE]: TypedKeyAndText<boolean>[]
[FieldKey.ALREADY_RECEIVE_OAS]: TypedKeyAndText<boolean>[]
[FieldKey.WHEN_TO_START]: TypedKeyAndText<boolean>[]
[FieldKey.OAS_DEFER]: TypedKeyAndText<boolean>[]
[FieldKey.LEGAL_STATUS]: TypedKeyAndText<LegalStatus>[]
[FieldKey.LIVED_ONLY_IN_CANADA]: TypedKeyAndText<boolean>[]
Expand Down
4 changes: 4 additions & 0 deletions i18n/web/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,10 @@ const en: WebTranslations = {
[ValidationErrors.receiveOASEmpty]:
//'Please indicate if you receive the OAS pension.',
'Please indicate if you receive the Old Age Security pension',
[ValidationErrors.whenToStartOAS]:
'Please indicate when to start your OAS pension',
[ValidationErrors.startDateForOAS]:
'You must be at least 65 and 1 month to start receiving the Old Age Security pension.',
[ValidationErrors.providePartnerIncomeEmpty]:
"Please indicate if you're able to provide your partner's income.",
[ValidationErrors.partnerIncomeEmpty]:
Expand Down
4 changes: 4 additions & 0 deletions i18n/web/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ const fr: WebTranslations = {
[ValidationErrors.receiveOASEmpty]:
//'Veuillez indiquer si vous recevez la pension de la SV.',
'Veuillez indiquer si vous recevez la pension de la Sécurité de la vieillesse',
[ValidationErrors.whenToStartOAS]:
'FRENCH ==> Please indicate when to start your OAS pension',
[ValidationErrors.startDateForOAS]:
'Vous devez avoir au moins 65 ans et 1 mois pour commencer à recevoir la pension de la Sécurité de la vieillesse.',
[ValidationErrors.providePartnerIncomeEmpty]:
'Veuillez indiquer si vous êtes en mesure de fournir le revenu de votre conjoint.',
[ValidationErrors.incomeWorkEmpty]:
Expand Down
Loading

0 comments on commit 6c1e4c5

Please sign in to comment.