# Web tests fake the server seams once

The session query, the auth client and the oRPC client each have one fake that every web test gets from the test setup. A new typed fake oRPC client runs the real TanStack Query utils, and a ratchet keeps vi.mock counts from growing.

- **One fake per seam, installed once.** A web test no longer writes `vi.mock("@/platform/rpc/orpc", …)` with a hand-built `orpc` object. `apps/web/src/test-setup.ts` installs `@/testing/fake-orpc`, `@/testing/fake-session-query` and `@/testing/fake-auth-client` for every test file, and a test programs them: `rpc.todo.stats.mockResolvedValue(stats)`, `seedSession(queryClient, session)`, `fakeAuth.signOut.mockResolvedValue(…)`. See [testing](/docs/development/testing#what-to-test). ([#254](https://github.com/CarlosZiegler/fofo/pull/254))
- **The fake oRPC client is typed and runs the real query utils.** `rpc` is typed by the app router, so an answer with the wrong shape fails `pnpm check-types`, and `orpc` is the real `createTanstackQueryUtils` over it, so query keys and inputs are the production ones. A procedure that no test programmed rejects by name. ([#254](https://github.com/CarlosZiegler/fofo/pull/254))
- **`vi.mock` counts only shrink.** `scripts/web-mock-targets.test.mjs` (in `pnpm test`) holds a baseline per mocked module. Web tests went from 94 `vi.mock` calls to 55; seven test files still stub a seam by hand and are listed in [#253](https://github.com/CarlosZiegler/fofo/issues/253). ([#254](https://github.com/CarlosZiegler/fofo/pull/254))
