test: backend unit + functional and iOS model tests, run in CI - #6
Merged
Conversation
Backend (node:test via tsx): - types.test.ts: mph/kph conversion helpers - wsHub.test.ts: broadcast, last-state replay, client cleanup - SimulatorSource.test.ts: emission shape and unit passthrough - server.functional.test.ts: real server child process, /health, /stream metric payload, token-guarded auth - add npm test script; exclude *.test.ts from the tsc build iOS (XCTest): - VehicleStateTests.swift: backend JSON contract decoding plus the derived UI values (usesMetric, primarySpeed, unitLabel) - add TeslaDashTests unit-test target and TeslaDash scheme in project.yml
- backend-ci: add npm test after the tsc build - ios-build: run xcodebuild test on an available iPhone simulator
node --test only expands the src/**/*.test.ts glob on Node 21+, so the Node 20 runner failed to find the test files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an automated test suite for both halves of Voltpit and wires it into CI.
Backend (
node:testrun viatsx)vehicle_statereplay on connect, status messages not replayed, client cleanup on close/error.primaryUnitpassthrough (mph/kph), speedKph derivation, Stockholm route bounds, stop halts ticks. MockedMath.random+ fake timers for determinism./health, the/streamWebSocket emitting a well-formed metricvehicle_state, and token-guarded auth (rejects missing/wrong tokens, accepts the right one).npm testscript and excludes*.test.tsfrom thetscbuild.iOS (XCTest)
vehicle_stateJSON contract (including parked/null fields) and verifies the UI-driving derived values (usesMetric,primarySpeedclamping,unitLabel). Adds aTeslaDashTestsunit-test target and aTeslaDashscheme inproject.yml.CI
npm testafter thetscbuild.xcodebuild teston a dynamically resolved iPhone simulator after the build.Results
cd backend && npm test).xcodebuild teston the iPhone 17 Pro simulator).Architecture impact
None. Test-only addition plus CI steps: no components, data flow, message contracts, or infra change, so the architecture docs are unchanged.