starbasedb icon indicating copy to clipboard operation
starbasedb copied to clipboard

test: cover websocket plugin behavior

Open Treasure520520 opened this issue 6 months ago • 0 comments

/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 executeQuery operation 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.ts
  • git diff --check

Note: this worktree reused the existing installed dependencies from the neighboring checkout because this machine does not have global pnpm available.

Treasure520520 avatar May 14 '26 12:05 Treasure520520