So most of this PR is restructuring the code so tests could be added.
Decided to use insta to build out the tests.
It works pretty well.
Moved the snapshots into sub folders .
[x] I discovered that we can chose to move the snapshots to a folder that is not inside the src directory by changing settings... So we need to decide where we want them.
I did trade off performance by converting the response to string before deserializing it into the struct but this allows us to store strings for testing and be closer to how the actual code works.
For problem_metadata I had to move the related structs into a separate module as they had a lot of functionality and it was getting confusing.
There is a lot of repeated code but not sure if it's worth trying to remove the duplication.
I did remove some amount of duplication where if they went out of sync it would cause problems.
This area of the code had no tests!!!
So most of this PR is restructuring the code so tests could be added. Decided to use insta to build out the tests. It works pretty well. Moved the snapshots into sub folders .
I did trade off performance by converting the response to string before deserializing it into the struct but this allows us to store strings for testing and be closer to how the actual code works.
For problem_metadata I had to move the related structs into a separate module as they had a lot of functionality and it was getting confusing.
There is a lot of repeated code but not sure if it's worth trying to remove the duplication.
I did remove some amount of duplication where if they went out of sync it would cause problems.