Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vahid-ahmadi committed Jan 14, 2025
1 parent a9ca8a7 commit c7c6762
Show file tree
Hide file tree
Showing 8 changed files with 474 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ brackets:
- threshold:
2015-01-01: 0
amount:
2015-01-01: 0
2015-01-01: 1_331
- threshold:
2015-01-01: 18
amount:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
- name: Under standard age limit - eligible
period: 2025
input:
age: 10
is_disabled_for_benefits: false
output:
child_age_eligible: true

- name: Over standard age limit and not disabled - ineligible
period: 2025
input:
age: 12
is_disabled_for_benefits: false
output:
child_age_eligible: false

- name: Over standard age but under disability limit and disabled - eligible
period: 2025
input:
age: 15
is_disabled_for_benefits: true
output:
child_age_eligible: true

- name: Over disability age limit and disabled - ineligible
period: 2025
input:
age: 17
is_disabled_for_benefits: true
output:
child_age_eligible: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Tests for age under 18 bracket (threshold: £1,331 quarterly)
- name: Under threshold for age 15 with low income and no other income sources - ineligible
period: 2025
input:
age: 15
total_income: 5000
private_pension_income: 0
savings_interest_income: 500
dividend_income: 0
property_income: 0
output:
meets_income_requirements: false

- name: At threshold for age 15 - eligible
period: 2025
input:
age: 15
total_income: 6324
private_pension_income: 0
savings_interest_income: 0
dividend_income: 0
property_income: 200
output:
meets_income_requirements: true

# Tests for age 18-20 bracket (threshold: £1,788 quarterly)
- name: Under threshold for age 19 - ineligible
period: 2025
input:
age: 19
total_income: 7000 # £1,750 quarterly
private_pension_income: 0
savings_interest_income: 0
dividend_income: 0
property_income: 0
output:
meets_income_requirements: false

- name: At threshold for age 19 - eligible
period: 2025
input:
age: 18
total_income: 7152 # £1,788 quarterly
private_pension_income: 0
savings_interest_income: 0
dividend_income: 0
property_income: 0
output:
meets_income_requirements: true

# Tests for age 21+ bracket (threshold: £2,379 quarterly)
- name: Under threshold for age 22 - ineligible
period: 2025
input:
age: 22
total_income: 9000 # £2,250 quarterly
private_pension_income: 0
savings_interest_income: 0
dividend_income: 0
property_income: 0
output:
meets_income_requirements: false

- name: age 18 - eligible
period: 2025
input:
age: 18
total_income: 9516 # £2,379 quarterly
private_pension_income: 0
savings_interest_income: 0
dividend_income: 0
property_income: 0
output:
meets_income_requirements: true

# Tests with investment income
- name: Above threshold but with investment income making eligible income below threshold - ineligible
period: 2025
input:
age: 22
total_income: 12000
private_pension_income: 3000
savings_interest_income: 500
dividend_income: 1000
property_income: 500
# Net eligible income: 7000 (£1,750 quarterly)
output:
meets_income_requirements: false

- name: Edge case with investment income exactly at threshold - eligible
period: 2025
input:
age: 15
total_income: 7324
private_pension_income: 2000
savings_interest_income: 0
dividend_income: 0
property_income: 0
# Net eligible income: 5324 (£1,331 quarterly)
output:
meets_income_requirements: true

# Test age boundary cases
- name: Age boundary test at 18 - using higher threshold
period: 2025
input:
age: 18
total_income: 7152
private_pension_income: 0
savings_interest_income: 100
dividend_income: 0
property_income: 0
output:
meets_income_requirements: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
- name: Couple both working - eligible
period: 2025
input:
people:
person:
is_adult: true
in_work: true
incapacity_benefit: 0
spouse:
is_adult: true
in_work: true
incapacity_benefit: 0
benunits:
benunit:
members: [person, spouse]
output:
childcare_work_condition: true

- name: Couple neither working - ineligible
period: 2025
input:
people:
person:
is_adult: true
in_work: false
incapacity_benefit: 0
spouse:
is_adult: true
in_work: false
incapacity_benefit: 0
benunits:
benunit:
members: [person, spouse]
output:
childcare_work_condition: false

- name: Couple one working one with disability - eligible
period: 2025
input:
people:
person:
is_adult: true
in_work: true
incapacity_benefit: 0
spouse:
is_adult: true
in_work: false
incapacity_benefit: 100
benunits:
benunit:
members: [person, spouse]
output:
childcare_work_condition: true

- name: Couple one working one with incapacity - eligible
period: 2025
input:
people:
person:
is_adult: true
in_work: true
incapacity_benefit: 0
spouse:
is_adult: true
in_work: false
incapacity_benefit: 100
benunits:
benunit:
members: [person, spouse]
output:
childcare_work_condition: true

- name: Couple one working without qualifying condition - ineligible
period: 2025
input:
people:
person:
is_adult: true
in_work: true
incapacity_benefit: 0
spouse:
is_adult: true
in_work: false
incapacity_benefit: 0
benunits:
benunit:
members: [person, spouse]
output:
childcare_work_condition: false

- name: Single working adult - eligible
period: 2025
input:
people:
person:
is_adult: true
in_work: true
incapacity_benefit: 0
benunits:
benunit:
members: [person]
output:
childcare_work_condition: true

- name: Single non-working adult - ineligible
period: 2025
input:
people:
person:
is_adult: true
in_work: false
incapacity_benefit: 0
benunits:
benunit:
members: [person]
output:
childcare_work_condition: false

- name: Couple both with disability one working - eligible
period: 2025
input:
people:
person:
is_adult: true
in_work: true
incapacity_benefit: 100
spouse:
is_adult: true
in_work: false
incapacity_benefit: 100
benunits:
benunit:
members: [person, spouse]
output:
childcare_work_condition: true

- name: Single working adult with disability - eligible
period: 2025
input:
people:
person:
is_adult: true
in_work: true
incapacity_benefit: 100
benunits:
benunit:
members: [person]
output:
childcare_work_condition: true

- name: Single disabled non-working adult - ineligible
period: 2025
input:
people:
person:
is_adult: true
in_work: false
incapacity_benefit: 100
benunits:
benunit:
members: [person]
output:
childcare_work_condition: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
- name: Eligible - does NOT receive any of these benefits
period: 2025
input:
working_tax_credit: 0
child_tax_credit: 0
universal_credit: 0
output:
incompatibilities_childcare_eligible: True


- name: Non eligible - receives benefits
period: 2025
input:
working_tax_credit: 1
child_tax_credit: 0
universal_credit: 0
output:
incompatibilities_childcare_eligible: False


- name: Non eligible - receives benefits
period: 2025
input:
working_tax_credit: 1
child_tax_credit: 1
universal_credit: 0
output:
incompatibilities_childcare_eligible: False


- name: Non eligible - receives benefits
period: 2025
input:
working_tax_credit: 1
child_tax_credit: 1
universal_credit: 1
output:
incompatibilities_childcare_eligible: False
Loading

0 comments on commit c7c6762

Please sign in to comment.