-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(query): add tests for IndexingService.Query function (#87)
Resolves storacha/project-tracking#171 Adds tests for the main `IndexingService.Query` function. The happy path test is useful to understand the behavior of the service fetching the different types of claims. **Note for reviewers:** the PR is not as big as it seems. I changed some interfaces dealing with `url.URL` to use `*url.URL`, which makes client code a bit more readable and is more idiomatic. A lot of files were touched just to update the type of the parameter/variable. ## Considerations I think the happy path test is the most valuable. I also added some basic tests for error conditions in the main dependencies. I thought of adding a test confirming the function filters non-relevant claims, but that is implemented by the `providerindex` package and tested there. Please let me know if you think I'm missing any other interesting tests. ## Known issues The addition of `MockProviderIndex` causes an import cycle in the tests of the `providerindex` package. These tests import the `mocks` package and the new mock imports the `providerindex` package to implement the mock. I think the best solution would be to change the mock generation configuration so that mocks are created in the same package as the interfaces they are mocking. That would avoid the cycle while allowing tests to live in the same package as the functions they are testing (which in turn enables testing non-exported members). I'll take care of that in a separate PR (#88).
- Loading branch information
Showing
28 changed files
with
950 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.