diff --git a/AGENTS.md b/AGENTS.md index 7c4af1e..5e1b410 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -47,4 +47,5 @@ bun run build - Add tests when behavior changes. - Verify Go tests after backend changes. - Verify Bun tests after TS client changes. +- For DB-required tests, prefer embedded/ephemeral Postgres fixtures over relying on an externally managed database. - If CI fails due runner/network infrastructure, keep logs explicit in workflow output. diff --git a/README.md b/README.md index 48cb4a9..aa47f28 100644 --- a/README.md +++ b/README.md @@ -97,3 +97,9 @@ Workflow: `.gitea/workflows/ci.yml` - `go test ./...` - `bun test` in `libs/geo-api-client` + +## Testing policy + +- Keep fast unit tests as the default (`go test ./...`). +- If a test requires a real Postgres instance, use embedded/ephemeral Postgres in the test process or test fixture lifecycle. +- Do not require manually running an external Postgres container for routine test runs. diff --git a/SKILL.md b/SKILL.md index 42928fc..32f074d 100644 --- a/SKILL.md +++ b/SKILL.md @@ -25,6 +25,7 @@ Use this skill when implementing or debugging backend, frontend integration, Typ - Update `internal/app/service.go` first. - Then wire request/response changes in `internal/http/handlers.go`. - Add/update tests in `internal/http/api_test.go`. + - If persistence behavior is under test, use embedded/ephemeral Postgres fixtures (no external DB dependency for standard test runs). 2. Frontend integration changes - Update TS client first in `libs/geo-api-client/src/`.