Public-Health-Scotland / phsmethods

An R package to standardise methods used in Public Health Scotland (https://public-health-scotland.github.io/phsmethods/)
https://public-health-scotland.github.io/phsmethods/
54 stars 13 forks source link

Fix the tests covering `age_from_chi` #97

Closed Moohan closed 1 year ago

Moohan commented 1 year ago

Some of these tests had failed because when you don't supply a ref_date it will calculate the age today (using Sys.Date()), this meant that the 'people' are now older than when we first wrote the tests, so age_from_chi no longer returned the expected age.

I wrote a small helper function to work out what the 'expected age' should be now, given the date we first set the tests.