-
Notifications
You must be signed in to change notification settings - Fork 3
Refactor OpenApiTypesense.Connection.new/1 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Adding missing validation and tests when making a new connection.
Reviewer's Guide by SourceryThe PR refactors the OpenApiTypesense.Connection.new/1 function to add proper validation for required connection fields and improves error handling. The implementation now validates that all required fields are present in the connection map and raises appropriate error messages when validation fails. The changes also include comprehensive test coverage for the connection creation functionality. No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @kianmeng - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Pull Request Test Coverage Report for Build a1b10d5ef3193d4b73abe7461886f991f3d5df69-PR-2Details
💛 - Coveralls |
|
Hi @kianmeng, thanks for the PR. There's an error in CI test: https://github.com/jaeyson/open_api_typesense/actions/runs/12332042761/job/34423378550?pr=2 1) test new/1 with empty map raises ArgumentError (OpenApiTypesense.ConnectionTest)
Error: test/open_api_typesense_connection_test.exs:34
Wrong message for ArgumentError
expected:
"Missing required fields: [:port, :scheme, :host, :api_key]"
actual:
"Missing required fields: [:api_key, :host, :port, :scheme]"
code: assert_raise ArgumentError, msg, fn -> Connection.new(%{}) end
stacktrace:
test/open_api_typesense_connection_test.exs:36: (test)
..................................................................
Finished in 0.6 seconds (0.6s async, 0.01s sync)
70 tests, 1 failureIs it the order of the list |
|
🥳 🥳 🥳 🥳 🥳 |
Adding missing validation and tests when making a new connection.
Summary by Sourcery
Refactor the Connection.new/1 function to include validation for required fields and add corresponding tests to ensure proper functionality and error handling.
Enhancements:
Tests: