Skip to main content

Testing

Full source: development/TESTING.md.

Package self-checks​

pnpm check (or pnpm -r check) runs assert-based checks inside the packages where correctness matters most: @betweenus/auth (tokens, secrets, algorithm pinning), @betweenus/nest-common (client address resolution, rate buckets), @betweenus/permissions (role/grant resolution), @betweenus/storage (keys, allowlists, inline safety), and auth-service (login, rotation, reuse detection, OAuth redirects) — each against an in-memory database, no external services required.

The admin panel carries its own: pnpm --filter @betweenus/admin check pins the byte and duration formatting (an off-by-1024 renders a plausible screen that is simply wrong) and renders the health screen from a typed fixture, including the S3 case where two storage figures are unknowable and must not be drawn as zero.

Integration smoke scripts​

Real REST + WebSocket traffic against a running stack, not mocks:

node apps/services/chat-service/smoke.mjs
node apps/services/presence-service/smoke.mjs
node apps/services/notification-service/smoke.mjs
node apps/services/remote-gateway/smoke.mjs
node apps/services/server-service/smoke.mjs # categories and the channel layout

The server-service smoke reads AUTH_URL (default http://127.0.0.1:3001) and SERVER_URL (default http://127.0.0.1:3003), so it can run against an auth service on another port.

These are what CI's integration job runs against Postgres/Redis service containers — see CI.

Two accounts, signed in, for manual testing​

Most things worth testing need a second participant — a message has a receiver, a call has another peer, and E2EE only means something when a key was actually exchanged between two devices.

pnpm dev:infra # Postgres and Redis
pnpm db:migrate # first run only
pnpm dev:backend # backend services (leave running)
pnpm dev:duo # in a second terminal

Opens two Electron windows, each already signed in and sharing a Duo Test server:

WindowAccountRole
Alicealice@betweenus.localserver owner
Bobbob@betweenus.localmember

Password for both: betweenus-dev-1. Alice owns #owners-only, a private channel Bob is deliberately not on; the two start as friends with a DM already open. Each window runs with its own Electron profile (BETWEENUS_PROFILE=duo-a/duo-b) — its own session, localStorage, and E2EE device key, because sharing a profile would defeat the point.

Re-running pnpm dev:duo is harmless — it signs in rather than re-registering if the accounts already exist.

What to check by hand​

  • Chat: a message typed in Alice's window appears in Bob's; the row in Postgres is ciphertext (pnpm db:studio).
  • Attachments: drag a photo onto the composer — the object on disk in storage-data is not a viewable image, which is the point. A file over 8 MB uploads in visible parts (multipart).
  • Voice/video: join the lounge voice channel from both windows.
  • Remote desktop: enroll a machine from Settings → Remote Access, grant a permission, request a session from the other window.
  • File transfer: grant REMOTE_FILE_TRANSFER and drop a file onto the remote screen. Check three things, not one: it lands in the machine's downloads folder; dropping the same file again produces name (2).ext rather than an overwrite; and cancelling part way through leaves nothing behind, not a truncated file that looks whole.
  • Audio: grant REMOTE_AUDIO and play something on the machine. Windows only — anywhere else the capture hands back no track and the header shows no sound button at all, which is the correct outcome rather than a failure.