--- description: Tests must be self-contained; mock external service dependencies globs: "**/*_test.go" alwaysApply: false --- # Test Isolation Tests must be self-contained. The only shared infrastructure allowed is the database. - **Database**: tests may depend on a real database connection — this is expected and acceptable. - **External services** (gRPC clients, HTTP APIs, third-party SDKs, etc.): must be mocked or stubbed. Tests must never make real calls to external services. - Use interfaces for service dependencies so they are straightforward to mock in tests. - Keep mocks minimal — only stub the methods the test actually exercises.