-
Notifications
You must be signed in to change notification settings - Fork 47
Update settings tests to assert field inclusion in API responses #634
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
WalkthroughThe test assertions in the Meilisearch index settings spec were updated from strict equality checks to partial inclusion checks. This adjustment affects pagination, typo tolerance, faceting, and localized attributes, allowing the tests to pass as long as the expected key-value pairs are present, regardless of any additional data. Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code Graph Analysis (1)spec/meilisearch/index/settings_spec.rb (3)
🔇 Additional comments (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #634 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 10 10
Lines 804 804
=========================================
Hits 804 804 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull Request Overview
This PR makes settings tests more flexible by replacing strict equality checks with partial inclusion checks, preventing failures when new fields appear in API responses.
- Replace
eq
matcher withinclude
for pagination, typo tolerance, and faceting settings assertions. - Refactor
localized_attributes
tests to verify array structure and partial matching of expected entries.
Comments suppressed due to low confidence (2)
spec/meilisearch/index/settings_spec.rb:609
- The test description mistypes the method name as
update_type_tolerance
; rename it toupdate_typo_tolerance
for consistency with the tested method.
it '#update_type_tolerance updates typo tolerance settings' do
spec/meilisearch/index/settings_spec.rb:801
- [nitpick] For consistency with other settings tests and to avoid breaks if new fields appear, consider using
include
instead ofeq
when asserting default localized attributes.
expect(index.localized_attributes).to eq(default_localized_attributes)
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.
LGTM!
bors merge
Pull Request
Related issue
This PR makes the settings tests more flexible by avoiding breaking when a Meilisearch version returns a new field that did not exist previously. See discussion meilisearch/integration-guides#316.
What does this PR do?
PR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!
Summary by CodeRabbit