> ## Documentation Index
> Fetch the complete documentation index at: https://help.xitter.space/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing

> Unit tests, end-to-end scripts and driving the real client.

## Unit tests

```sh theme={null}
bun run test:unit
```

This runs the scripts that use `bun:test`, without needing a server.

`.github/workflows/tests.yml` runs these on pushes and pull requests. It then checks password and two-factor concurrency, poll visibility, search operators, API request limits, email confirmations, data exports, scheduled threads and quotas, bookmark pagination, media privacy, chunked video uploads, account settings and encrypted chat, against a fresh PostgreSQL 18 database and a local server. The pinned client isn't downloaded there; checks that need it report a skip.

## Database-only checks

The `test-*-concurrency.ts`, `test-poll-visibility.ts` and `test-search-operators.ts` scripts can run against a dedicated, migrated test database without a server. Set `DATABASE_URL` to that database; each script creates and removes its own test accounts.

## End-to-end scripts

`scripts/test-*.ts` check each feature against a running server, for example:

```sh theme={null}
bun scripts/test-posts.ts <user A> <user B> <password>
```

Each script's first lines give its arguments. Set `RATE_LIMITS=off` on the server while running them.

| Script | Checks |
| - | - |
| `test-chat.ts` | Encryption, access controls, requests, groups, socket delivery, attachments and history. Creates and removes temporary users. |
| `test-chat-token.ts` | Chat token validation, without a server (`bun test`). |
| `test-juicebox.ts` | Realm registration and recovery. Run it with `recover` after a restart to check durability. `TEST_JUICEBOX_URL` selects the realm. |
| `test-conversation-live.ts` | Conversation card uploads, publication, previews and sharing. |
| `test-hate.ts` | Automod evasions and false positives, without a server (`bun test`). |
| `test-automod.ts` | The strike ladder, expiry, write paths and request limits. |
| `test-notes.ts` | Community Notes. |
| `test-admin-extra.ts` | Staff messages, standings, notes, sessions and settings. |
| `test-staff-permissions.ts` | Staff permissions. |
| `test-migration.ts` | Moving an account between two instances. |
| `test-ratelimit.ts` | Rate limits. |

Others include `test-account-settings`, `test-two-factor`, `test-password-reset`, `test-reply-limits`, `test-views`, `test-protected`, `test-communities`, `test-lists`, `test-polls` and `test-scheduled`.

> [!NOTE]
>
> A passing script is not a working screen. Check the UI with `drive.ts` too.

## Driving the real client

```sh theme={null}
bun scripts/drive.ts <path> <steps...>
```

This clicks through the real client in headless Edge and takes screenshots. It uses the browser profile `scripts/probe.sh` leaves signed in.

## Finding missing handlers

`GET /_debug/unknown` (admins only) lists the client calls no handler answers yet, most frequent first. Start there when a screen is empty. `LOG_REQUESTS=1` logs every API call, and `LOG_REQUESTS=errors` also prints the client's error reports.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.