Skip to content

Commit

Permalink
Merge pull request #991 from DTS-STN/question-update
Browse files Browse the repository at this point in the history
144220 Income questions updates
  • Loading branch information
shawn320 authored Jan 10, 2024
2 parents 8aedc4b + 5643f8c commit 088ac96
Show file tree
Hide file tree
Showing 30 changed files with 589 additions and 61 deletions.
50 changes: 50 additions & 0 deletions __tests__/pages/api/benefits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ describe('consolidated benefit tests: unavailable and errors (screening out)', (
const res = await mockGetRequest({
...income10k,
...age65NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
receiveOAS: false,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.SINGLE,
Expand Down Expand Up @@ -124,6 +126,8 @@ describe('consolidated benefit tests: unavailable and errors (screening out)', (
const res = await mockGetRequest({
...income10k,
...age65NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
receiveOAS: false,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.SINGLE,
Expand Down Expand Up @@ -201,6 +205,8 @@ describe('consolidated benefit tests: unavailable and errors (screening out)', (
const res = await mockGetRequest({
...income10k,
...age60NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
receiveOAS: false,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.SINGLE,
Expand Down Expand Up @@ -256,6 +262,8 @@ describe('consolidated benefit tests: ineligible', () => {
const res = await mockGetRequest({
incomeAvailable: true,
income: 20000,
incomeWork: 0,
partnerIncomeWork: 0,
age: 50,
oasDefer: false,
receiveOAS: false,
Expand Down Expand Up @@ -340,6 +348,8 @@ describe('consolidated benefit tests: max income checks', () => {
incomeAvailable: true,
income: legalValues.gis.singleIncomeLimit,
...age65NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
receiveOAS: false,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.SINGLE,
Expand All @@ -354,6 +364,8 @@ describe('consolidated benefit tests: max income checks', () => {
res = await mockGetRequest({
...input,
income: legalValues.gis.singleIncomeLimit - 1,
incomeWork: 0,
partnerIncomeWork: 0,
invSeparated: false,
})
// expectGisEligible(res)
Expand All @@ -363,6 +375,8 @@ describe('consolidated benefit tests: max income checks', () => {
incomeAvailable: true,
income: legalValues.gis.spouseNoOasIncomeLimit,
...age65NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
receiveOAS: false,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.PARTNERED,
Expand Down Expand Up @@ -392,6 +406,8 @@ describe('consolidated benefit tests: max income checks', () => {
incomeAvailable: true,
income: legalValues.gis.spouseOasIncomeLimit,
...age65NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
receiveOAS: false,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.PARTNERED,
Expand Down Expand Up @@ -422,6 +438,8 @@ describe('consolidated benefit tests: max income checks', () => {
const input = {
incomeAvailable: true,
income: legalValues.gis.spouseAlwIncomeLimit,
incomeWork: 0,
partnerIncomeWork: 0,
...age65NoDefer,
receiveOAS: false,
oasDeferDuration: undefined,
Expand Down Expand Up @@ -455,6 +473,8 @@ describe('consolidated benefit tests: max income checks', () => {
incomeAvailable: true,
income: legalValues.alw.alwIncomeLimit,
...age60NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
receiveOAS: false,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.PARTNERED,
Expand All @@ -476,6 +496,8 @@ describe('consolidated benefit tests: max income checks', () => {
res = await mockGetRequest({
...input,
income: legalValues.alw.alwIncomeLimit - 1,
incomeWork: 0,
partnerIncomeWork: 0,
})
// expectAlwEligible(res)
})
Expand All @@ -485,6 +507,8 @@ describe('consolidated benefit tests: max income checks', () => {
incomeAvailable: true,
income: legalValues.alw.afsIncomeLimit,
...age60NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
receiveOAS: false,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.WIDOWED,
Expand All @@ -505,6 +529,8 @@ describe('consolidated benefit tests: eligible: 65+', () => {
const res = await mockGetRequest({
...income10k,
...age65NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
receiveOAS: false,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.SINGLE,
Expand All @@ -527,6 +553,8 @@ describe('consolidated benefit tests: eligible: 65+', () => {
const res = await mockGetRequest({
incomeAvailable: true,
income: 100000,
incomeWork: 0,
partnerIncomeWork: 0,
...age65NoDefer,
receiveOAS: false,
oasDeferDuration: undefined,
Expand All @@ -547,6 +575,8 @@ describe('consolidated benefit tests: eligible: 65+', () => {
it('returns "eligible" - living in Canada, under 20 years in Canada, lived in social country', async () => {
const res = await mockGetRequest({
...income10k,
incomeWork: 0,
partnerIncomeWork: 0,
...age65NoDefer,
receiveOAS: false,
oasDeferDuration: undefined,
Expand All @@ -567,6 +597,8 @@ describe('consolidated benefit tests: eligible: 65+', () => {
const res = await mockGetRequest({
...income10k,
...age65NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
receiveOAS: false,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.SINGLE,
Expand Down Expand Up @@ -599,6 +631,8 @@ describe('consolidated benefit tests: eligible: 65+', () => {
...income10k,
...age65NoDefer,
receiveOAS: false,
incomeWork: 0,
partnerIncomeWork: 0,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.SINGLE,
livingCountry: LivingCountry.NO_AGREEMENT,
Expand Down Expand Up @@ -629,6 +663,8 @@ describe('consolidated benefit tests: eligible: 65+', () => {
...income10k,
...age65NoDefer,
receiveOAS: false,
incomeWork: 0,
partnerIncomeWork: 0,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.PARTNERED,
...canadian,
Expand Down Expand Up @@ -708,6 +744,8 @@ describe('consolidated benefit tests: eligible: 65+', () => {
const res = await mockGetRequest({
incomeAvailable: true,
income: legalValues.oas.incomeLimit - 1,
incomeWork: 0,
partnerIncomeWork: 0,
...age65NoDefer,
receiveOAS: false,
oasDeferDuration: undefined,
Expand Down Expand Up @@ -744,6 +782,8 @@ describe('consolidated benefit tests: eligible: 65+', () => {
it('returns "eligible" - married, full oas, age 75', async () => {
const res = await mockGetRequest({
...income10k,
incomeWork: 0,
partnerIncomeWork: 0,
age: 75,
oasDefer: false,
receiveOAS: false,
Expand Down Expand Up @@ -786,6 +826,8 @@ describe('consolidated benefit tests: eligible: 60-64', () => {
it('returns "ALW eligible" - married', async () => {
const res = await mockGetRequest({
...income10k,
incomeWork: 0,
partnerIncomeWork: 0,
...age60NoDefer,
receiveOAS: false,
oasDeferDuration: undefined,
Expand Down Expand Up @@ -837,6 +879,8 @@ describe('consolidated benefit tests: eligible: 60-64', () => {
const res = await mockGetRequest({
...income10k,
...age60NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
receiveOAS: false,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.PARTNERED,
Expand All @@ -862,6 +906,8 @@ describe('consolidated benefit tests: eligible: 60-64', () => {
const res = await mockGetRequest({
...income10k,
...age60NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
receiveOAS: false,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.PARTNERED,
Expand All @@ -888,6 +934,8 @@ describe('consolidated benefit tests: eligible: 60-64', () => {
const res = await mockGetRequest({
...income10k,
...age60NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
receiveOAS: false,
oasDeferDuration: undefined,
maritalStatus: MaritalStatus.PARTNERED,
Expand Down Expand Up @@ -915,6 +963,8 @@ describe('consolidated benefit tests: eligible: 60-64', () => {
it('returns "ALW eligible" - age 64, married, 19 years in Canada, lived in social country', async () => {
const res = await mockGetRequest({
...income10k,
incomeWork: 0,
partnerIncomeWork: 0,
age: 64,
oasDefer: false,
receiveOAS: false,
Expand Down
16 changes: 16 additions & 0 deletions __tests__/pages/api/field-reqs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ describe('field requirement analysis', () => {
const res = await mockGetRequest({
incomeAvailable: undefined,
income: undefined,
incomeWork: undefined,
partnerIncomeWork: undefined,
age: undefined,
oasDefer: undefined,
oasAge: undefined,
Expand All @@ -38,6 +40,7 @@ describe('field requirement analysis', () => {
expect(res.body.missingFields).toEqual([
FieldKey.AGE,
FieldKey.INCOME,
FieldKey.INCOME_WORK,
FieldKey.LEGAL_STATUS,
FieldKey.LIVING_COUNTRY,
FieldKey.LIVED_ONLY_IN_CANADA,
Expand All @@ -46,6 +49,7 @@ describe('field requirement analysis', () => {
expect(res.body.visibleFields).toEqual([
FieldKey.AGE,
FieldKey.INCOME,
FieldKey.INCOME_WORK,
FieldKey.LEGAL_STATUS,
FieldKey.LIVING_COUNTRY,
FieldKey.LIVED_ONLY_IN_CANADA,
Expand All @@ -56,6 +60,8 @@ describe('field requirement analysis', () => {
it('requires no fields when all provided', async () => {
const res = await mockGetRequest({
...income10k,
incomeWork: 0,
partnerIncomeWork: 0,
age: 65,
oasDefer: true,
oasAge: 70,
Expand Down Expand Up @@ -84,6 +90,7 @@ describe('field requirement analysis', () => {
FieldKey.OAS_AGE,
// FieldKey.INCOME_AVAILABLE,
FieldKey.INCOME,
FieldKey.INCOME_WORK,
FieldKey.LEGAL_STATUS,
FieldKey.LIVING_COUNTRY,
FieldKey.LIVED_ONLY_IN_CANADA,
Expand All @@ -94,6 +101,7 @@ describe('field requirement analysis', () => {
FieldKey.PARTNER_AGE,
// FieldKey.PARTNER_INCOME_AVAILABLE,
FieldKey.PARTNER_INCOME,
FieldKey.PARTNER_INCOME_WORK,
// FieldKey.PARTNER_BENEFIT_STATUS,
FieldKey.PARTNER_LEGAL_STATUS,
FieldKey.PARTNER_LIVING_COUNTRY,
Expand All @@ -107,6 +115,8 @@ describe('field requirements analysis: conditional fields', () => {
it('requires "yearsInCanadaSince18" when livedOnlyInCanada=true', async () => {
const res = await mockGetRequest({
...income10k,
incomeWork: 0,
partnerIncomeWork: 0,
...age65NoDefer,
receiveOAS: false,
oasDeferDuration: undefined,
Expand All @@ -126,6 +136,8 @@ describe('field requirements analysis: conditional fields', () => {
it('requires "everLivedSocialCountry" when living in Canada and under 10 years in Canada', async () => {
const res = await mockGetRequest({
...income10k,
incomeWork: 0,
partnerIncomeWork: 0,
...age65NoDefer,
receiveOAS: false,
oasDeferDuration: undefined,
Expand All @@ -145,6 +157,8 @@ describe('field requirements analysis: conditional fields', () => {
it('requires "everLivedSocialCountry" when living in No Agreement and under 20 years in Canada', async () => {
const res = await mockGetRequest({
...income10k,
incomeWork: 0,
partnerIncomeWork: 0,
...age65NoDefer,
receiveOAS: false,
oasDeferDuration: undefined,
Expand All @@ -165,6 +179,8 @@ describe('field requirements analysis: conditional fields', () => {
it('requires partner questions when marital=married', async () => {
const res = await mockGetRequest({
...income10k,
incomeWork: 0,
partnerIncomeWork: 0,
...age65NoDefer,
receiveOAS: false,
oasDeferDuration: undefined,
Expand Down
14 changes: 14 additions & 0 deletions __tests__/pages/api/help-me-find-out.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ describe('Help Me Find Out scenarios', () => {
incomeAvailable: true,
income: legalValues.gis.spouseNoOasIncomeLimit,
...age65NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
maritalStatus: MaritalStatus.PARTNERED,
invSeparated: false,
...canadian,
Expand All @@ -45,6 +47,8 @@ describe('Help Me Find Out scenarios', () => {
res = await mockGetRequest({
...input,
income: legalValues.gis.spouseNoOasIncomeLimit - 1,
incomeWork: 0,
partnerIncomeWork: 0,
})
// expectOasGisEligible(res)
//expect(res.body.results.gis.entitlement.result).toEqual(0.72) // table 3
Expand Down Expand Up @@ -112,6 +116,8 @@ describe('Help Me Find Out scenarios', () => {
it(`works when client old, partner young (partner=noAllowance, therefore gis table 3)`, async () => {
const input = {
incomeAvailable: true,
incomeWork: 0,
partnerIncomeWork: 0,
income: legalValues.alw.alwIncomeLimit, // too high for allowance
...age65NoDefer,
maritalStatus: MaritalStatus.PARTNERED,
Expand All @@ -137,6 +143,8 @@ describe('Help Me Find Out scenarios', () => {
const input = {
incomeAvailable: true,
income: legalValues.alw.alwIncomeLimit - 1, // okay for allowance
incomeWork: 0,
partnerIncomeWork: 0,
...age65NoDefer,
maritalStatus: MaritalStatus.PARTNERED,
invSeparated: false,
Expand All @@ -160,6 +168,8 @@ describe('Help Me Find Out scenarios', () => {
const input = {
...incomeZero,
...age60NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
maritalStatus: MaritalStatus.PARTNERED,
invSeparated: false,
...canadian,
Expand Down Expand Up @@ -196,6 +206,8 @@ describe('Help Me Find Out scenarios', () => {
...age60NoDefer,
maritalStatus: MaritalStatus.PARTNERED,
invSeparated: false,
incomeWork: 0,
partnerIncomeWork: 0,
...canadian,
livedOnlyInCanada: true,
yearsInCanadaSince18: undefined,
Expand Down Expand Up @@ -223,6 +235,8 @@ describe('Help Me Find Out scenarios', () => {
const input = {
...incomeZero,
...age60NoDefer,
incomeWork: 0,
partnerIncomeWork: 0,
maritalStatus: MaritalStatus.PARTNERED,
invSeparated: false,
...canadian,
Expand Down
Loading

0 comments on commit 088ac96

Please sign in to comment.