Skip to content

test(api): pin filtered country counts and the plain place-list keys - #503

Merged
Ardnived merged 4 commits into
mainfrom
test/place-list-filter-cases
Nov 26, 2026
Merged

Ardnived merged 4 commits into
mainfrom
test/place-list-filter-cases

Conversation

@Ardnived

Copy link
Copy Markdown
Contributor

Summary

Change outline

Behaviour — what the new cases pin

 describe('getRegion (region-tree derivation)')          src/config/api/fetch.test.ts
   …
   it('counts and lists only what the filters let through, framing on everything')
+  it('counts countries only by what the filters let through, and drops a country with none')
+    getCountries()                    → belgium 5
+    getCountries(DEFAULT_FILTERS)     → same as no filters
+    getCountries({ format: online })  → belgium 2
+    getCountries({ languages: [xx] }) → []      # nothing matches: the country drops out
+  it('keys an unfiltered place list exactly as its writers do, and a filtered one apart')
+    regionQuery(slug, locale, DEFAULT_FILTERS) → ['region', slug, locale]
+    countriesQuery(DEFAULT_FILTERS)            → ['countries']
+    format alone, or region alone              → a key apart from the plain one
   it('counts online classes under the region cut, not worldwide')

Preview

No preview surface: tests only, no shipped code changes.

Test results

  • Lean gate: ✓ (lint, typecheck, test:run: 206 files, 2584 passed, 1 skipped)
  • Targeted specs: src/config/api/fetch.test.ts 36 passed
  • Each new case watched failing against its defect: getCountries ignoring filters; regionQuery/countriesQuery keying on filters when none are active; activeFilterCount dropping region
  • Build: N/A

Notes for reviewer

Tiny diff, read inline. Security review ran (src/config/api/ path trigger): no findings.

Detail

Filed from the "place lists follow the filters" ticket, whose fix (ported from 032f476 on ux/states) had already landed in #371: visibleFeatures in getCountries/getRegion, getOnlineCount, filter-aware regionQuery/countriesQuery, and ActiveFilterPills + the no-results panel + useFilterSearch links in CountriesView, RegionView and OnlineView. The ticket's tests item was the only part still open.

Self-review (/code-review high) findings:

  • Fixed: a comment claimed the case proves /?langs=xx reaches the no-results panel; it pins only the empty list.
  • Fixed: no spec pinned that a region cut alone marks filters active, so a region-only key could share the unfiltered entry. Added.
  • Dismissed: languages order in the key is already pinned by filtersKey's own spec in src/lib/shape/filters.test.ts.
  • Dismissed: countriesQuery is imported from ./fetch, where it is declared. That import predates this branch.
  • Dismissed: placement in the getRegion describe, which already holds the getCountries, getOnlineCount and countriesQuery warm-up cases that share its fixtures.

Docs checked, nothing stale.

🤖 Generated with Claude Code

Ardnived and others added 4 commits November 26, 2026 10:29
Place lists already follow the filters (#371). These cases cover what
fetch.test.ts left open: getCountries with and without filters (a country
nothing matches drops out), and regionQuery/countriesQuery keeping the
plain key their writers use when no filter is active.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sydevs-dispatcher

sydevs-dispatcher Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running

Written by the sydevs dispatcher. Sessions never edit this comment.

@Ardnived
Ardnived merged commit 12f0d13 into main Nov 26, 2026
13 checks passed
@Ardnived
Ardnived deleted the test/place-list-filter-cases branch November 26, 2026 17:37
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Pending to Done in SYDevelopers Technical Roadmap Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant