Skip to content

Assert filter identities, sort order, and pagination edges - #43

Merged
turegjorup merged 3 commits into
developfrom
test/filter-identity-and-sort-assertions
Jul 8, 2026
Merged

turegjorup merged 3 commits into
developfrom
test/filter-identity-and-sort-assertions

Conversation

@turegjorup

Copy link
Copy Markdown
Contributor

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

  • Add AbstractApiTestCase::assertMemberIds() — asserts the exact set of member identities (entityId, or slug for Tag/Vocabulary), order-independent by default.
  • Convert all seven *FilterTest suites from assertCount to assertMemberIds, with named datasets and the reasoning for each expected id set.
  • Add SortTest pinning ElasticSearchIndex::getSort() across all three branches: events (title.keyword asc), occurrence endpoints (start asc), organizations (name.keyword asc) — a contract asserted nowhere before.
  • Add pagination-edge cases to PaginationTest: out-of-range page → empty member list but full hydra:totalItems; totalItems reflects an active filter; walking single-item pages covers the full set with no gaps or duplicates.
  • Pin the non-nested occurrences semantic (F7): event 8 matches occurrences.start[gte] and occurrences.end[lte] bounds satisfied by different occurrences, because the field is a plain object, not nested.

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 SortTest locks the default ordering (there is no client sort parameter yet, so the current order is the contract). Tests only — no production code changes.

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-commenter

codecov-commenter commented Jul 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.99%. Comparing base (d6f37ac) to head (0cb9d10).
⚠️ Report is 12 commits behind head on develop.

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     
Flag Coverage Δ
unittests 72.99% <ø> (+1.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@turegjorup turegjorup self-assigned this Jul 8, 2026
…ty-and-sort-assertions

# Conflicts:
#	CHANGELOG.md
@turegjorup
turegjorup merged commit 52ed189 into develop Jul 8, 2026
10 checks passed
@turegjorup
turegjorup deleted the test/filter-identity-and-sort-assertions branch July 8, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants