rust-practice / cargo-leet

Program to make working on leetcode problems locally more convenient
Apache License 2.0
5 stars 3 forks source link

Remove flatpath #81

Closed c-git closed 9 months ago

c-git commented 9 months ago

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.

pawarherschel commented 9 months ago

please update the pull request description / message