Skip to content

Commit

Permalink
make tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-solo committed Nov 12, 2024
1 parent 07cb74a commit 66db96f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions __tests__/pages/api/field-reqs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('field requirement analysis', () => {
partnerYearsInCanadaSince18: 5,
})
// expect(res.body.summary.state).toEqual(SummaryState.AVAILABLE_ELIGIBLE)
expect(res.body.missingFields).toEqual([])
expect(res.body.missingFields).toEqual(['partnerYearsInCanadaSinceOAS'])
expect(res.body.visibleFields).toEqual([
FieldKey.MARITAL_STATUS,
FieldKey.INV_SEPARATED,
Expand All @@ -105,7 +105,7 @@ describe('field requirement analysis', () => {
// FieldKey.PARTNER_LEGAL_STATUS,
FieldKey.PARTNER_LIVING_COUNTRY,
FieldKey.PARTNER_LIVED_ONLY_IN_CANADA,
FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_18,
FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_OAS,
FieldKey.OAS_AGE,
])
})
Expand Down
18 changes: 18 additions & 0 deletions __tests__/utils/excelReaderUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,24 @@ function createTransformedPayload(rowToTransform: string): Record<string, any> {
],
rowToTransform['Partner Birth Year and Month']
),
partnerYearsInCanadaSinceOAS:
transformLiveOnlyCanadaValue(
rowToTransform[
'Partner: # of years resided in Canada after age 18 (Full, 40, 10, etc.)'
]
) !== 'true'
? transformValue(
rowToTransform["Partner Rec'ing OAS (Yes / No / IDK)"]
) === 'true'
? transformYearsInCanadaSinceOAS18Value(
rowToTransform['Partner Age'],
rowToTransform[
'Partner: # of years resided in Canada after age 18 (Full, 40, 10, etc.)'
],
rowToTransform['Partner Birth Year and Month']
)
: undefined
: undefined,
}
payload = Object.fromEntries(
Object.entries(payload).filter(
Expand Down
2 changes: 0 additions & 2 deletions utils/api/fieldsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,8 @@ export class FieldsHandler {
this.input.client.partnerBenefitStatus.value ===
PartnerBenefitStatus.OAS_GIS
) {
console.log('INSIDEs')
requiredFields.push(FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_OAS)
} else {
console.log('INSIDESEEEEEE')
requiredFields.push(FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_18)
}
}
Expand Down

0 comments on commit 66db96f

Please sign in to comment.