Skip to content

test: add download, style-downloader, and tile-downloader tests; fix error propagation#98

Merged
gmaclennan merged 7 commits intomainfrom
feat/better-test-coverage
Mar 20, 2026
Merged

test: add download, style-downloader, and tile-downloader tests; fix error propagation#98
gmaclennan merged 7 commits intomainfrom
feat/better-test-coverage

Conversation

@gmaclennan
Copy link
Member

Summary

  • Add comprehensive test suites for download(), StyleDownloader, and downloadTiles/tileIterator (38 new tests)
  • Fix uncaught error in download() when getStyle() fails — errors from unreachable URLs were becoming unhandled rejections instead of propagating through the returned stream
  • Add Readonly<BBox> type annotations to accept readonly bbox tuples in public APIs
  • Add startSMPServer() test utility for serving SMP fixtures over HTTP

Test plan

  • All new tests pass (npx vitest run --project node)
  • Existing tests unaffected
  • Error propagation fix verified by "download stream emits error for unreachable URL" test

gmaclennan and others added 3 commits March 20, 2026 10:49
Add comprehensive test coverage for the download pipeline:
- test/download.js: end-to-end download tests with tile/glyph/sprite verification
- test/style-downloader.js: StyleDownloader unit tests (constructor, getStyle, getSprites, getGlyphs, getTiles)
- test/tile-downloader.js: tileIterator algorithm tests and downloadTiles functional tests
- test/utils/smp-server.js: shared test utility for SMP HTTP server

Also includes minor fixes:
- download.js: handle error when Writer init fails before style download completes
- Type annotations: use Readonly<BBox> for bbox parameters across download pipeline

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gmaclennan gmaclennan enabled auto-merge (squash) March 20, 2026 23:02
@gmaclennan gmaclennan self-assigned this Mar 20, 2026
@gmaclennan gmaclennan merged commit 911d64d into main Mar 20, 2026
15 checks passed
@gmaclennan gmaclennan deleted the feat/better-test-coverage branch March 20, 2026 23:52
This was referenced Mar 20, 2026
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.

1 participant