Skip to content

Test the API handler and the server layer - #7

Merged
comstud merged 1 commit into
mainfrom
comstud/handlers-services-tests
Aug 30, 2026
Merged

Test the API handler and the server layer#7
comstud merged 1 commit into
mainfrom
comstud/handlers-services-tests

Conversation

@comstud

@comstud comstud commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Both packages leaned on the apps/rotom-ng integration tests for what coverage they had: libs/handlers 55%, libs/services 79%. This takes them to 91% and 96%.

APIHandler is generic over its controller and worker types, so the tests instantiate it with fakes and drive its HTTP surface against a real ConnectionManager, selector, and jobs manager. That covers the device and controller action error mapping, the jobs endpoints, and pprof gating, none of which were exercised before.

For the server layer: UI serving from both a directory and an embedded FS, session routes staying reachable without a credential, /api guarded while the UI is not, listener-versus-address serving, bind failure, route-installer errors, and shutdown timing out on an in-flight request.

libs/services/static is a test fixture rather than a shipped asset. The embedded UI is served from a directory of that name at the root of the FS, so covering that path needs one in the package; its embed directive lives in the test file and never reaches a real build.

Claude-Session: https://claude.ai/code/session_01AXB8suZYfpYZsSaoEps67m

Both packages leaned on the apps/rotom-ng integration tests for what
coverage they had: libs/handlers 55%, libs/services 79%. This takes them
to 91% and 96%.

APIHandler is generic over its controller and worker types, so the tests
instantiate it with fakes and drive its HTTP surface against a real
ConnectionManager, selector, and jobs manager. That covers the device and
controller action error mapping, the jobs endpoints, and pprof gating,
none of which were exercised before.

For the server layer: UI serving from both a directory and an embedded
FS, session routes staying reachable without a credential, /api guarded
while the UI is not, listener-versus-address serving, bind failure,
route-installer errors, and shutdown timing out on an in-flight request.

libs/services/static is a test fixture rather than a shipped asset. The
embedded UI is served from a directory of that name at the root of the
FS, so covering that path needs one in the package; its embed directive
lives in the test file and never reaches a real build.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AXB8suZYfpYZsSaoEps67m
@comstud
comstud merged commit cfd407b into main Aug 30, 2026
5 checks passed
@comstud
comstud deleted the comstud/handlers-services-tests branch August 30, 2026 05:45
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