Skip to content

test: expand URL state tests with edge cases and round-trips#845

Open
NewCoder3294 wants to merge 1 commit intokoala73:mainfrom
NewCoder3294:test/url-state-edge-cases
Open

test: expand URL state tests with edge cases and round-trips#845
NewCoder3294 wants to merge 1 commit intokoala73:mainfrom
NewCoder3294:test/url-state-edge-cases

Conversation

@NewCoder3294
Copy link
Contributor

Summary

Expands tests/urlState.test.mts from 8 tests (3 suites) to 70 tests (16 suites) covering comprehensive edge cases for parseMapUrlState and buildMapUrl.

New test categories (62 new tests across 13 new suites):

parseMapUrlState edge cases:

  • Empty/missing input (2 tests) — empty string, bare ?
  • Country validation (7 tests) — invalid codes, lowercase normalization, empty, single char, digits, URL-encoded, whitespace trimming
  • Zoom boundaries (8 tests) — 0, -1, 25, NaN, Infinity, -Infinity, fractional, non-numeric
  • Lat/lon boundaries (10 tests) — valid extremes (90/180), out-of-bounds clamping, NaN, independent parsing
  • TimeRange validation (6 tests) — valid values, invalid "99h", empty, arbitrary string, case mismatch
  • View validation (3 tests) — valid value, invalid value, empty
  • Layer parsing (7 tests) — selective enable, unknown names ignored, "none", empty, absent, extra commas, whitespace
  • Duplicate params (2 tests) — first-value-wins for country and zoom
  • Missing ? prefix (1 test) — params without leading ?

buildMapUrl edge cases:

  • Default/minimal URL (4 tests) — null center, no country, layers=none, required params present
  • All parameters set (1 test) — full URL with every param
  • Center edge cases (2 tests) — undefined center, 4-decimal formatting

Round-trip tests:

  • Parameter round-trips (9 tests) — every view value, zoom, lat/lon precision, all timeRange values, country, expanded, multiple layers, layers=none, complex state with all params

Test plan

  • All 70 tests pass with node --import tsx --test tests/urlState.test.mts
  • Type checks pass (pre-push hook)
  • CI should confirm green on this branch

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 2, 2026

@NewCoder3294 is attempting to deploy a commit to the Elie Team on Vercel.

A member of the Team first needs to authorize it.

@koala73 koala73 added Ready to Merge PR is mergeable, passes checks, and adds value Low Value Trivial, unnecessary, or not aligned with project needs labels Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Low Value Trivial, unnecessary, or not aligned with project needs Ready to Merge PR is mergeable, passes checks, and adds value

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants