# Testing and verification

Verify domain behavior against real Postgres and the deployed runtime shape.

## Fast gates [#fast-gates]

```sh
pnpm install --frozen-lockfile
pnpm check-types
pnpm lint
pnpm exec oxlint
FORMAT_BASE_REF=origin/main pnpm format:check
pnpm test
pnpm --filter mobile exec tsc --noEmit
```

Type checks do not validate Worker bundling or database behavior. The format check compares changed files to its base reference; use the intended review base.

## Isolated Postgres [#isolated-postgres]

```sh
node scripts/test-local-postgres.mjs exec pnpm test:integration
node scripts/test-local-postgres.mjs exec node scripts/test-local-jobs.mjs
```

The wrapper creates a disposable local cluster, exports the owned test database variables, applies migrations and stops its cluster when the child finishes. It refuses unsafe assumptions about a remote/shared test database. The jobs harness runs the built Worker with controlled provider fixtures and exercises persisted outcomes, timeouts, leases and repeated ticks.

Effect timeout unit tests use `@effect/vitest` with `TestClock` and production durations. Queue persistence changes additionally require the fault gate in [ADR-0006](/docs/adr/0006-effect-persisted-queue).

## Built Worker [#built-worker]

```sh
pnpm --filter web build
# Run from apps/web in an isolated local test environment:
pnpm exec wrangler dev -c dist/server/wrangler.json --local --port 8790
```

Provide the Hyperdrive local override for the configured binding ID with a password-bearing URL such as `postgresql://postgres:local@127.0.0.1:PORT/postgres`. The exact variable name comes from the Wrangler binding. Keep local tests local; do not deploy to discover a bundling failure.

The build checks that client assets contain no server-only markers and that production AI code does not gain the server-function manifest dependency. Runtime smoke checks should include a public page, the changed API, auth refusal paths and discovery endpoints.

## Docs checks [#docs-checks]

The web unit suite loads compiled MDX, validates metadata and links, orders releases, and checks Markdown/discovery output. Browser review covers light/dark, desktop/mobile, keyboard focus, local diagram scrolling, code blocks and the command palette. Bundle reports separate total client assets from the initial route graph.


## Key files [#key-files]

- [`scripts/test-local-postgres.mjs`](https://github.com/CarlosZiegler/doro/blob/main/scripts/test-local-postgres.mjs)
- [`scripts/test-local-jobs.mjs`](https://github.com/CarlosZiegler/doro/blob/main/scripts/test-local-jobs.mjs)
- [`apps/web/scripts/assert-client-bundle-clean.mjs`](https://github.com/CarlosZiegler/doro/blob/main/apps/web/scripts/assert-client-bundle-clean.mjs)

