Skip to content

test: web worker coverage — supabase.db + supabase.websocket #11595

Description

@h0lybyte

Tracker: #11592

Problem

`apps/kbve/astro-kbve/src/workers/supabase.db.ts` and `supabase.websocket.ts` proxy Supabase RPC + realtime through a Web Worker so the main thread stays responsive. There are 0 tests. The existing `astro check` flagged unused `WorkerResponse` types in both files — a sign that internals aren't being exercised.

Acceptance

  • Stand up a vitest project that can import the worker source directly (no Worker constructor needed; the worker code is just a module)
  • `supabase.db.test.ts`:
    • Message types in / out are exhaustive (insert / update / upsert / delete / select / RPC)
    • Errors from `@kbve/droid` strategies surface as `{ ok: false, error }` responses, never thrown
    • Race conditions: two simultaneous RPC calls with the same id resolve independently
  • `supabase.websocket.test.ts`:
    • Channel subscribe / unsubscribe lifecycle
    • The `await channel.subscribe()` warning (currently flagged as no-effect) is either fixed or explicitly justified
    • Backoff on reconnect doesn't tight-loop when the server is down

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions