Skip to content

Commit

Permalink
Merge pull request #322 from DTS-STN/legal-values-auto-update
Browse files Browse the repository at this point in the history
Auto-update legal values
  • Loading branch information
JeremyKennedy authored Jul 18, 2022
2 parents 7614e0b + d0388c9 commit 60ae74f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 44 deletions.
4 changes: 2 additions & 2 deletions __tests__/pages/api/benefits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,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 @@ -639,7 +639,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 @@ -43,7 +43,7 @@ describe('OAS entitlement scenarios', () => {
everLivedSocialCountry: undefined,
...partnerUndefined,
})
expectOasEligible(res, EntitlementResultType.PARTIAL, 632.45)
expectOasEligible(res, EntitlementResultType.PARTIAL, 650.16)
})
})

Expand All @@ -57,7 +57,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 @@ -68,7 +68,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 @@ -81,7 +81,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 @@ -94,7 +94,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 @@ -108,7 +108,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 @@ -122,7 +122,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 @@ -136,7 +136,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 @@ -149,7 +149,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 @@ -162,7 +162,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 @@ -176,7 +176,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 @@ -190,7 +190,7 @@ describe('GIS entitlement scenarios', () => {
everLivedSocialCountry: undefined,
...partnerUndefined,
})
expectGisEligible(res, 1414.36)
expectGisEligible(res, 1455.11)
})
})

Expand Down Expand Up @@ -230,7 +230,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 @@ -244,7 +244,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 @@ -257,7 +257,7 @@ describe('Allowance entitlement scenarios', () => {
...partnerIncomeZero,
...partnerNoHelpNeeded,
})
expectAlwEligible(res, 1231.87)
expectAlwEligible(res, 1266.36)
})
})

Expand Down Expand Up @@ -452,7 +452,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 @@ -463,7 +463,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 @@ -474,6 +474,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
}
}

0 comments on commit 60ae74f

Please sign in to comment.