2.6 KiB
2.6 KiB
Tasks — testing-integration-oauth-mock
1. Package scaffold
- 1.1 Create
packages/testkit/testing/testing-integration-oauth-mock/withpackage.json,tsconfig.json,vitest.config.ts,README.md. - 1.2 No
@suaveplan/*runtime deps (rule 8). Types-only@suaveplan/typesallowed if needed. - 1.3
package.jsonexports:.(root),./testing(conformance helpers if any),./package.json.
2. Implementation (feature folders per CLAUDE.md)
- 2.1
src/server/server.ts—createMockOauthIdp(opts)factory; Bun.serve HTTP server; ephemeral port;stop()returnsPromise<void>. - 2.2
src/endpoints/authorize.ts—GET /authorize(state echo, PKCE challenge capture, redirect with code). - 2.3
src/endpoints/token.ts—POST /token(code-exchange, PKCE verify, refresh-token flow, configurable expiry). - 2.4
src/endpoints/userinfo.ts—GET /userinfo(bearer auth; primed user payload). - 2.5
src/endpoints/openid.ts—/.well-known/openid-configuration+/jwks.json(gated onopenid: true). - 2.6
src/control/primer.ts—primeUser/primeErrorqueues; FIFO consumption. - 2.7
src/control/audit.ts—lastRequest/allRequestssnapshot (frozen). - 2.8
src/shapes/github.ts,src/shapes/google.ts,src/shapes/generic.ts— default user payloads. - 2.9
src/error-codes/—OAUTH_MOCK_*registry. - 2.10 Sibling
.mdfor every implementation file (≥200 words, all sections).
3. Tests
- 3.1 Each endpoint has a colocated
.test.tsexercising happy path + every error path. 100% istanbul on touched modules. - 3.2 End-to-end test in
src/server/server.test.tsdrives a full/authorize→ callback →/token→/userinforound-trip via real HTTP. - 3.3 PKCE flow tested with both
plainandS256challenges. - 3.4 RFC-6749 error responses tested (
access_denied,invalid_grant,invalid_request). - 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/runnerimport is required.
4. Pre-publish gate
- 4.1
bunx turbo lint typecheck test --filter=@suaveplan/testing-integration-oauth-mockgreen. - 4.2
bunx turbo test:coverage --filter=@suaveplan/testing-integration-oauth-mock100%. - 4.3
bun scripts/folder-reorg/generate-manifest.tsto refreshMANIFEST.md.
5. Archive
- 5.1 Fold delta into
openspec/specs/testing-integration-oauth-mock/spec.md. - 5.2 Move folder to
openspec/archive/2026-05-26-testing-integration-oauth-mock/.