test(history): add tests for History API v2 endpoints#2490
Open
dirkwa wants to merge 1 commit intoSignalK:masterfrom
Open
test(history): add tests for History API v2 endpoints#2490dirkwa wants to merge 1 commit intoSignalK:masterfrom
dirkwa wants to merge 1 commit intoSignalK:masterfrom
Conversation
tkurki
reviewed
Mar 22, 2026
Contributor
Author
|
Verified that security is intact after merge |
The History API v2 provider system (registerHistoryApiProvider) was added in SignalK#2100 but had no test coverage. Add tests for: - 501 response when no provider is registered - Provider registration and discovery via _providers endpoint - Values, paths, and contexts endpoints with a registered provider - 400 response for missing required query parameters Uses testplugin as a mock history provider returning static data.
3d67c35 to
8bc2fe2
Compare
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.
Description:
This adds tests for the History API v2 provider system (
registerHistoryApiProvider) which was added in #2100.Adds 7 tests covering the History API v2 surface:
/history/valuesreturns 501 with error message/_providers,/history/valuesreturns data with correct shape (context, range, values, data),/history/pathsand/history/contextsreturn arrays from the provider, missingpathsparameter returns 400Response validation uses TypeBox schemas (
ValuesResponseSchema,HistoryProvidersResponseSchema) from@signalk/server-api/typeboxinstead of hand-crafted assertions.Manual Tests
GET /history/values?paths=navigation.position&from=...&to=...— 200, correct response shapeGET /history/_providers— 200, lists provider withisDefaultGET /history/_providers/_default— 200, returns provider idGET /history/paths?from=...&to=...— 200, returns arrayGET /history/contexts?from=...&to=...— 200, returns arrayGET /history/values?from=...&to=...(missingpaths) — 400, validation error