-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Copy link
Description
During #317 I noticed 9 functions return a different result between the API and a local SQL query.
- Add tests all exported functions to see if API and local queries match
- Create custom expectation for comparing api to sql query
- find why there is a mismatch, and fix it!
Some of these differences might be fixed, or at least different after merging #328
API - SQL mismatch
mismatches for:
- get_cpod_projects
- list_animal_project_codes
- list_acoustic_project_codes
- get_animals
- list_receiver_ids
- get_tags
- get_animal_projects
- list_scientific_names
- get_acoustic_projects
Maybe this is a good use case for a [custom expectation](https://testthat.r-lib.org/articles/custom-expectation.html).
For example, you could create a expect_call_agnostic(), with one argument: a function call. The helper could grab the function call (and its arguments), run it locally and over API and expect the result to be the same.
It could then be called as part of a regular test-function.R file:
testthat("get_animals() returns same result locally and via API", {
expect_call_agnostic(get_animals(animal_id = "5"))
})
_Originally posted by @peterdesmet in https://github.com/inbo/etn/issues/317#issuecomment-2421841943_