test: the SPA's chat tests on the port, client, store and link embeds

- vitest runs app/**/*.test.ts and tests/**/*.test.ts; the SPA's
  chatEvents, chatFormat, chatText, chatUnread and realtime tests sit next
  to their ports with only import paths changed
- linkEmbeds: escaping, http(s) only, rel and target, registry order
- client: every endpoint, refresh-and-retry, unauthorized, 422, upload
- store: bootstrap, anonymous and non-member starts, lazy joins, DMs,
  live messages and unread, threads, pins, reactions, slash commands,
  polling without realtime, onUserEvent, DM-only actions
This commit is contained in:
Jakub Zych
2026-11-01 19:17:42 +01:00
parent 764cb42894
commit b6d3389e46
11 changed files with 1670 additions and 5 deletions

12
tests/support/http.ts Normal file
View File

@@ -0,0 +1,12 @@
// bm's ApiError (src/api/http.ts), for the ported realtime test: it rejects
// the stubbed token route with one, and the route answers its status.
export class ApiError extends Error {
status: number
errors: Record<string, string[]>
constructor(status: number, message: string, errors: Record<string, string[]> = {}) {
super(message)
this.name = 'ApiError'
this.status = status
this.errors = errors
}
}