Files
2026-05-27 23:29:53 +01:00

40 lines
2.6 KiB
Markdown

# Tasks — testing-integration-oauth-mock
## 1. Package scaffold
- [x] 1.1 Create `packages/testkit/testing/testing-integration-oauth-mock/` with `package.json`, `tsconfig.json`, `vitest.config.ts`, `README.md`.
- [x] 1.2 No `@suaveplan/*` runtime deps (rule 8). Types-only `@suaveplan/types` allowed if needed.
- [x] 1.3 `package.json` exports: `.` (root), `./testing` (conformance helpers if any), `./package.json`.
## 2. Implementation (feature folders per CLAUDE.md)
- [x] 2.1 `src/server/server.ts` — `createMockOauthIdp(opts)` factory; Bun.serve HTTP server; ephemeral port; `stop()` returns `Promise<void>`.
- [x] 2.2 `src/endpoints/authorize.ts` — `GET /authorize` (state echo, PKCE challenge capture, redirect with code).
- [x] 2.3 `src/endpoints/token.ts` — `POST /token` (code-exchange, PKCE verify, refresh-token flow, configurable expiry).
- [x] 2.4 `src/endpoints/userinfo.ts` — `GET /userinfo` (bearer auth; primed user payload).
- [x] 2.5 `src/endpoints/openid.ts` — `/.well-known/openid-configuration` + `/jwks.json` (gated on `openid: true`).
- [x] 2.6 `src/control/primer.ts` — `primeUser`/`primeError` queues; FIFO consumption.
- [x] 2.7 `src/control/audit.ts` — `lastRequest`/`allRequests` snapshot (frozen).
- [x] 2.8 `src/shapes/github.ts`, `src/shapes/google.ts`, `src/shapes/generic.ts` — default user payloads.
- [x] 2.9 `src/error-codes/` — `OAUTH_MOCK_*` registry.
- [x] 2.10 Sibling `.md` for every implementation file (≥200 words, all sections).
## 3. Tests
- [x] 3.1 Each endpoint has a colocated `.test.ts` exercising happy path + every error path. 100% istanbul on touched modules.
- [x] 3.2 End-to-end test in `src/server/server.test.ts` drives a full `/authorize` → callback → `/token` → `/userinfo` round-trip via real HTTP.
- [x] 3.3 PKCE flow tested with both `plain` and `S256` challenges.
- [x] 3.4 RFC-6749 error responses tested (`access_denied`, `invalid_grant`, `invalid_request`).
- [x] 3.5 Test files import from `@suaveplan/testing/runner` (rule 11). NOTE: this package is rule-8 testing-infrastructure but NOT on the rule-11 exempt allowlist, so the `@suaveplan/testing/runner` import is required.
## 4. Pre-publish gate
- [x] 4.1 `bunx turbo lint typecheck test --filter=@suaveplan/testing-integration-oauth-mock` green.
- [x] 4.2 `bunx turbo test:coverage --filter=@suaveplan/testing-integration-oauth-mock` 100%.
- [x] 4.3 `bun scripts/folder-reorg/generate-manifest.ts` to refresh `MANIFEST.md`.
## 5. Archive
- [x] 5.1 Fold delta into `openspec/specs/testing-integration-oauth-mock/spec.md`.
- [x] 5.2 Move folder to `openspec/archive/2026-05-26-testing-integration-oauth-mock/`.