starbasedb
starbasedb copied to clipboard
test: cover websocket plugin behavior
/claim #71
Summary
Adds a focused, non-overlapping Vitest coverage slice for the WebSocket plugin.
Covered behavior:
- default and custom socket route registration
- non-upgrade requests returning the existing 400 response without opening a socket pair
- WebSocket upgrade responses returning the client socket and accepting the server socket
- query messages calling the injected
executeQueryoperation with context data and sending the serialized result back - non-query messages being ignored
sendMessage()delegating to the provided client socket
This is test-only and does not change production behavior.
Verification
../starbasedb/node_modules/.bin/vitest run plugins/websocket/index.test.ts --config ../starbasedb/vitest.config.ts../starbasedb/node_modules/.bin/prettier --check plugins/websocket/index.test.tsgit diff --check
Note: this worktree reused the existing installed dependencies from the neighboring checkout because this machine does not have global pnpm available.