# 09 — Testing ## Required before merge ```bash go test ./... ``` All tests must pass before any change is merged. ## Where to add tests | Change area | Test location | |-------------|---------------| | Collectors | `internal/collector/*_test.go` | | HTTP handlers | `internal/server/*_test.go` | | Exporters | `internal/exporter/*_test.go` | | Parsers | `internal/parser/vendors//*_test.go` | ## Exporter tests The Reanimator exporter has comprehensive coverage: | Test file | Coverage | |-----------|----------| | `reanimator_converter_test.go` | Unit tests per conversion function | | `reanimator_integration_test.go` | Full export with realistic `AnalysisResult` | Run exporter tests only: ```bash go test ./internal/exporter/... go test ./internal/exporter/... -v -run Reanimator go test ./internal/exporter/... -cover ``` ## Guidelines - Prefer table-driven tests for parsing logic (multiple input variants). - Do not rely on network access in unit tests. - Test both the happy path and edge cases (missing fields, empty collections). - When adding a new vendor parser, include at minimum: - `Detect()` test with a positive and a negative sample file list. - `Parse()` test with a minimal but representative archive.