Testing
"/home/yossef/notes/git/projects/maplibra/Testing.md"
path: maplibra/Testing.md
- **fileName**: Testing
- **Created on**: 2026-06-16 00:48:42
Testing
Purpose: How route and app behavior is verified.
Related: ./Home.md, ./Commands.md, ./modules/Route Smoothing.md, ./modules/Bootstrap System.md
Framework
Tests use Vitest. The project can run all tests with npx vitest run or focused files by passing paths.
Test Coverage Areas
Routing & Pathfinding
tests/route-smoothing.test.js— smoothing helpers, walkability sampling, asset-provider fallback, staircase straightening.tests/route-features.test.js— route feature generation and smoothing pipeline integration.tests/route-trace.test.js— route trace diagnostics and segment logging.tests/routing-cost.test.js— edge cost functions and accessibility weights.tests/pathfinding.test.js— A* algorithm correctness.tests/pathfinding-controller.test.js— controller initialization and graph loading.tests/pathfinding-controller-slices.test.js— slice-based graph loading.tests/pathfinding-graph-service.test.js— graph data service.tests/pathfinding-routing-engine.test.js— JS vs WASM engine selection.
Graph & Binary
tests/zip-node-builder.test.js— derived asset graph generation, door bridging, corridor center-line nodes.tests/integration-realmap.test.js— integration checks against available real map zip data.tests/binary-graph-*.test.js— binary graph loading, schema, parity, serialization.tests/graph-slice-*.test.js— graph slice loading, schema, cache, serialization.tests/build-routing-graph.test.js— offline graph generation.tests/build-routing-graph-door-nodes.test.js— door node generation.tests/portal-*.test.js— portal graph building, multi-floor, walkability gates.
WASM
tests/route-kernel-*.test.js— WASM kernel bridge, loader, options, parity.tests/path-worker-binary.test.js— path worker binary graph handling.tests/benchmark-routing-wasm-fixtures.test.js— WASM benchmark fixtures.
Startup & Bootstrap
tests/bootstrap-*.test.js— shell, map, data, routing, search, debug bootstraps.tests/startup-*.test.js— task queue, deferred work, derived assets, loading overlay, offline package, routing assets.tests/cached-mvf-loader.test.js— cache restoration.tests/mvf-loader.test.js— ZIP parsing and manifest loading.
UI & Layers
tests/ui-manager-*.test.js— floor controls, location handling, zoom behavior.tests/search-box-*.test.js— search input, suggestions, inline host.tests/search-bootstrap.test.js— search bootstrap initialization.tests/visibility-manager.test.js— layer visibility and floor filtering.tests/legend-toggle-manager.test.js— legend toggle state and persistence.tests/layer-manager-lazy-debug.test.js— lazy debug layer loading.tests/style-layer.test.js— style layer rendering.tests/theme-host-mode.test.js— theme in Android host mode.
Outdoor & Navigation
tests/outdoor-routing.test.js— outdoor route stitching.tests/unified-outdoor-route.test.js— unified indoor+outdoor graph.tests/outdoor-drop-route.test.js— outdoor drop mode.tests/navigation-ui-camera.test.js— navigation camera behavior.tests/navigation-icon-theme.test.js— navigation icon theming.tests/gps-tracking.test.js— live GPS tracking.tests/follow-camera.test.js— camera follow during navigation.tests/live-location-interactions.test.js— live location UI interactions.tests/mobile-route-sheet.test.js— mobile route sheet UI.
Performance & Assets
tests/perf-budget.test.js— startup performance budgets.tests/performance-routing.test.js— routing performance.tests/build-analysis.test.js— build output analysis.tests/derived-cache-source-identity.test.js— cache key identity.tests/offline-package-derived-cache.test.js— offline package caching.
Android & Mobile
tests/native-controls-layout.test.js— native controls layout.tests/android-bridge.test.js— bridge communication (if exists).tests/theme-host-mode.test.js— host mode theme behavior.
Current Baseline
After the staircase straightening change, focused routing tests pass. A full run showed 295 passed and 5 known pre-existing failures in graph-slice/in-flight/snapping tests.
Known failing areas at that point:
tests/pathfinding-controller-slices.test.jstests/pathfinding-controller.test.jstests/pathfinding-graph-service.test.jstests/snapping.test.js
Useful Commands
npx vitest run tests/route-smoothing.test.js tests/route-features.test.jsnpx vitest run tests/route-trace.test.jsnpx vitest run tests/zip-node-builder.test.js tests/integration-realmap.test.jsnpx vitest run tests/outdoor-routing.test.js tests/unified-outdoor-route.test.jsnpx vitest run tests/bootstrap-*.test.jsnpx vitest run tests/startup-*.test.jsnpx vitest run
Route Trace Diagnostics
Add routing.trace=1 to the local URL, compute a route, then inspect window.InGuide.pathfindingController.getRecentRouteTraces() in DevTools. Route trace segment entries include compact coords samples for rawSegments, smoothedSegments, and renderedSegments, which makes it possible to see whether zigzags survive smoothing or are reintroduced during rendering.
Test Setup
tests/setup.js configures the Vitest environment with any global mocks or polyfills needed for Mapbox GL, Web Workers, and IndexedDB.
continue:[[]]
before:[[]]