Repository navigation
Assert filter identities, sort order, and pagination edges - #43
Merged
Merged
Conversation
Convert the seven *FilterTest suites from count-based to identity-based assertions via a new AbstractApiTestCase::assertMemberIds() helper, so a filter returning the wrong records (not merely the wrong number) is caught. Add SortTest to pin ElasticSearchIndex::getSort() (events by title.keyword, occurrence endpoints by start, organizations by name.keyword) and pagination-edge cases: out-of-range page, totalItems under a filter, and single-item-page slice stability. Pin the non-nested occurrences semantic (F7): an event matches occurrences.start and occurrences.end bounds satisfied by different occurrences, so a future switch to a `nested` mapping is a conscious BC decision.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #43 +/- ##
=============================================
+ Coverage 71.89% 72.99% +1.09%
- Complexity 226 232 +6
=============================================
Files 29 29
Lines 637 648 +11
=============================================
+ Hits 458 473 +15
+ Misses 179 175 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ty-and-sort-assertions # Conflicts: # CHANGELOG.md
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sharpens the behavioural test suite from counts to identities ahead of the API Platform upgrade, so a filter regression that returns the wrong records — not just the wrong number of them — is caught.
Changes
AbstractApiTestCase::assertMemberIds()— asserts the exact set of member identities (entityId, orslugfor Tag/Vocabulary), order-independent by default.*FilterTestsuites fromassertCounttoassertMemberIds, with named datasets and the reasoning for each expected id set.SortTestpinningElasticSearchIndex::getSort()across all three branches: events (title.keywordasc), occurrence endpoints (startasc), organizations (name.keywordasc) — a contract asserted nowhere before.PaginationTest: out-of-range page → empty member list but fullhydra:totalItems;totalItemsreflects an active filter; walking single-item pages covers the full set with no gaps or duplicates.occurrencessemantic (F7): event 8 matchesoccurrences.start[gte]andoccurrences.end[lte]bounds satisfied by different occurrences, because the field is a plain object, notnested.Why
The suite that guards the upcoming API Platform upgrade was count-based, so a filter could return a different-but-same-sized result set undetected. Identity assertions close that gap, and
SortTestlocks the default ordering (there is no client sort parameter yet, so the current order is the contract). Tests only — no production code changes.