Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-update legal values #322

Merged
merged 2 commits into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions __tests__/pages/api/benefits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ describe('consolidated benefit tests: eligible: 65+', () => {
res,
EntitlementResultType.PARTIAL,
roundToTwo(legalValues.oas.amount / 2),
324.34
333.41
)
expectAlwAfsTooOld(res)
})
Expand Down Expand Up @@ -586,7 +586,7 @@ describe('consolidated benefit tests: eligible: 65+', () => {
expectAlwAfsTooOld(res)

// test clawback: expect some due to high income
expect(res.body.results.oas.entitlement.clawback).toEqual(7784.04)
expect(res.body.results.oas.entitlement.clawback).toEqual(7873.65)

// test oas increase at 75
expect(res.body.results.oas.entitlement.resultAt75).toEqual(
Expand Down
12 changes: 6 additions & 6 deletions __tests__/pages/api/help-me-find-out.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Help Me Find Out scenarios', () => {
income: legalValues.gis.spouseNoOasIncomeLimit - 1,
})
expectOasGisEligible(res)
expect(res.body.results.gis.entitlement.result).toEqual(0.79) // table 3
expect(res.body.results.gis.entitlement.result).toEqual(0.72) // table 3
})
it(`works when client old, partner old (partner=partialOas, therefore gis income limit ${legalValues.gis.spouseOasIncomeLimit}, gis table 2)`, async () => {
const input = {
Expand Down Expand Up @@ -84,7 +84,7 @@ describe('Help Me Find Out scenarios', () => {
income: legalValues.gis.spouseOasIncomeLimit - 1,
})
expectOasGisEligible(res)
expect(res.body.results.gis.entitlement.result).toEqual(0.68) // table 2
expect(res.body.results.gis.entitlement.result).toEqual(0.82) // table 2
})
it(`works when client old, partner old (partner=fullOas, therefore gis income limit ${legalValues.gis.spouseOasIncomeLimit}, gis table 2)`, async () => {
const input = {
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('Help Me Find Out scenarios', () => {
income: legalValues.gis.spouseOasIncomeLimit - 1,
})
expectOasGisEligible(res)
expect(res.body.results.gis.entitlement.result).toEqual(0.68) // table 2
expect(res.body.results.gis.entitlement.result).toEqual(0.82) // table 2
})
it(`works when client old, partner young (partner=noAllowance, therefore gis table 3)`, async () => {
const input = {
Expand All @@ -140,7 +140,7 @@ describe('Help Me Find Out scenarios', () => {
let res = await mockGetRequest(input)
expectOasGisEligible(res)

expect(res.body.results.gis.entitlement.result).toEqual(223.79) // table 3
expect(res.body.results.gis.entitlement.result).toEqual(229.72) // table 3
})
it('works when client old, partner young (partner=allowance, therefore gis table 4)', async () => {
const input = {
Expand All @@ -163,7 +163,7 @@ describe('Help Me Find Out scenarios', () => {
}
let res = await mockGetRequest(input)
expectOasGisEligible(res)
expect(res.body.results.gis.entitlement.result).toEqual(224.11) // table 4
expect(res.body.results.gis.entitlement.result).toEqual(229.9) // table 4
})
it('works when client young, partner young (no one gets anything)', async () => {
const input = {
Expand Down Expand Up @@ -220,7 +220,7 @@ describe('Help Me Find Out scenarios', () => {
let res = await mockGetRequest(input)
expect(res.body.summary.state).toEqual(SummaryState.AVAILABLE_ELIGIBLE)
expectOasGisTooYoung(res)
expectAlwEligible(res, 1231.87) // table 4
expectAlwEligible(res, 1266.36) // table 4
expect(res.body.results.afs.eligibility.result).toEqual(
ResultKey.INELIGIBLE
)
Expand Down
36 changes: 18 additions & 18 deletions __tests__/pages/api/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('OAS entitlement scenarios', () => {
everLivedSocialCountry: undefined,
...partnerUndefined,
})
expectOasEligible(res, EntitlementResultType.PARTIAL, 632.45)
expectOasEligible(res, EntitlementResultType.PARTIAL, 650.16)
})
})

Expand All @@ -51,7 +51,7 @@ describe('GIS entitlement scenarios', () => {
...canadaWholeLife,
...partnerUndefined,
})
expectGisEligible(res, 402.79)
expectGisEligible(res, 425.72)
})
it('returns "$959.26" when single and 0 income', async () => {
const res = await mockGetRequest({
Expand All @@ -62,7 +62,7 @@ describe('GIS entitlement scenarios', () => {
...canadaWholeLife,
...partnerUndefined,
})
expectGisEligible(res, 968.86)
expectGisEligible(res, 995.99)
})
it('returns "$850.26" when married and 10000 income and no partner OAS', async () => {
const res = await mockGetRequest({
Expand All @@ -75,7 +75,7 @@ describe('GIS entitlement scenarios', () => {
...partnerIncomeZero,
...partnerNoHelpNeeded,
})
expectGisEligible(res, 861.86)
expectGisEligible(res, 892.99)
})
it('returns "$959.26" when married and 0 income and no partner OAS', async () => {
const res = await mockGetRequest({
Expand All @@ -88,7 +88,7 @@ describe('GIS entitlement scenarios', () => {
...partnerIncomeZero,
...partnerNoHelpNeeded,
})
expectGisEligible(res, 968.86)
expectGisEligible(res, 995.99)
})
it('returns "$819.26" when married and 10000 income + 1000 partner income and no partner OAS', async () => {
const res = await mockGetRequest({
Expand All @@ -102,7 +102,7 @@ describe('GIS entitlement scenarios', () => {
partnerIncome: 1000,
...partnerNoHelpNeeded,
})
expectGisEligible(res, 830.86)
expectGisEligible(res, 861.99)
})
it('returns "$306.33" when married and 10000 income + 1000 partner income and partner OAS', async () => {
const res = await mockGetRequest({
Expand All @@ -116,7 +116,7 @@ describe('GIS entitlement scenarios', () => {
partnerIncome: 1000,
...partnerNoHelpNeeded,
})
expectGisEligible(res, 311.68)
expectGisEligible(res, 326.82)
})
it('returns "$521.33" when married and 10000 income + 1000 partner income and partner Allowance', async () => {
const res = await mockGetRequest({
Expand All @@ -130,7 +130,7 @@ describe('GIS entitlement scenarios', () => {
partnerIncome: 1000,
...partnerNoHelpNeeded,
})
expectGisEligible(res, 528.68)
expectGisEligible(res, 549.82)
})
it('returns "$577.43" when married and 0 income + 0 partner income and partner OAS', async () => {
const res = await mockGetRequest({
Expand All @@ -143,7 +143,7 @@ describe('GIS entitlement scenarios', () => {
...partnerIncomeZero,
...partnerNoHelpNeeded,
})
expectGisEligible(res, 583.2)
expectGisEligible(res, 599.53)
})
it('returns "$577.43" when married and 0 income + 0 partner income and partner Allowance', async () => {
const res = await mockGetRequest({
Expand All @@ -156,7 +156,7 @@ describe('GIS entitlement scenarios', () => {
...partnerIncomeZero,
...partnerNoHelpNeeded,
})
expectGisEligible(res, 583.2)
expectGisEligible(res, 599.53)
})
it('returns "$1239.38" when single and 1000 income, only 20 years in Canada (Partial OAS)', async () => {
const res = await mockGetRequest({
Expand All @@ -170,7 +170,7 @@ describe('GIS entitlement scenarios', () => {
everLivedSocialCountry: undefined,
...partnerUndefined,
})
expectGisEligible(res, 1252.2)
expectGisEligible(res, 1288.4)
})
it('returns "$1399.95" when single and 1000 income, only 10 years in Canada (Partial OAS)', async () => {
const res = await mockGetRequest({
Expand All @@ -184,7 +184,7 @@ describe('GIS entitlement scenarios', () => {
everLivedSocialCountry: undefined,
...partnerUndefined,
})
expectGisEligible(res, 1414.36)
expectGisEligible(res, 1455.11)
})
})

Expand Down Expand Up @@ -224,7 +224,7 @@ describe('Allowance entitlement scenarios', () => {
...partnerIncomeZero,
...partnerNoHelpNeeded,
})
expectAlwEligible(res, 341.68)
expectAlwEligible(res, 362.82)
})

it('returns "eligible for $565.35" when 40 years in Canada and income=10000', async () => {
Expand All @@ -238,7 +238,7 @@ describe('Allowance entitlement scenarios', () => {
...partnerIncomeZero,
...partnerNoHelpNeeded,
})
expectAlwEligible(res, 565.35)
expectAlwEligible(res, 598.65)
})
it('returns "eligible for $1231.87" when 40 years in Canada and income=0', async () => {
const res = await mockGetRequest({
Expand All @@ -251,7 +251,7 @@ describe('Allowance entitlement scenarios', () => {
...partnerIncomeZero,
...partnerNoHelpNeeded,
})
expectAlwEligible(res, 1231.87)
expectAlwEligible(res, 1266.36)
})
})

Expand Down Expand Up @@ -437,7 +437,7 @@ describe('AFS entitlement scenarios', () => {
...canadaWholeLife,
...partnerUndefined,
})
expectAfsEligible(res, 270.73)
expectAfsEligible(res, 301.48)
})
it('returns "eligible for $681.35" when 40 years in Canada and income=10000', async () => {
const res = await mockGetRequest({
Expand All @@ -448,7 +448,7 @@ describe('AFS entitlement scenarios', () => {
...canadaWholeLife,
...partnerUndefined,
})
expectAfsEligible(res, 694.4)
expectAfsEligible(res, 731.31)
})
it('returns "eligible for $1468.47" when 40 years in Canada and income=0', async () => {
const res = await mockGetRequest({
Expand All @@ -459,6 +459,6 @@ describe('AFS entitlement scenarios', () => {
...canadaWholeLife,
...partnerUndefined,
})
expectAfsEligible(res, 1468.47)
expectAfsEligible(res, 1509.58)
})
})
38 changes: 20 additions & 18 deletions utils/api/scrapers/output/legalValuesJson.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
{
"lastUpdatedYear": 2022,
"lastUpdatedQuarter": "April to June 2022",
"lastUpdatedQuarter": "July to September 2022",
"oas": {
"amount": 648.67,
"incomeLimit": 133527,
"clawbackIncomeLimit": 79054
"amount": 666.83,
"amount75": 733.51,
"incomeLimit": 134253,
"incomeLimit75": 136920,
"clawbackIncomeLimit": 81761
},
"gis": {
"singleAmount": 968.86,
"singleIncomeLimit": 19656,
"spouseOasAmount": 583.2,
"spouseOasIncomeLimit": 25968,
"spouseNoOasAmount": 968.86,
"spouseNoOasIncomeLimit": 47136,
"spouseAlwAmount": 583.2,
"spouseAlwIncomeLimit": 36384
"singleAmount": 995.99,
"singleIncomeLimit": 20208,
"spouseOasAmount": 599.53,
"spouseOasIncomeLimit": 26688,
"spouseNoOasAmount": 995.99,
"spouseNoOasIncomeLimit": 48432,
"spouseAlwAmount": 599.53,
"spouseAlwIncomeLimit": 37392
},
"alw": {
"alwAmount": 1231.87,
"alwIncomeLimit": 36384,
"afsAmount": 1468.47,
"afsIncomeLimit": 26496
"alwAmount": 1266.36,
"alwIncomeLimit": 37392,
"afsAmount": 1509.58,
"afsIncomeLimit": 27240
},
"topUp": {
"single": 150.07,
"married": 42.52
"single": 154.27,
"married": 43.71
}
}