# 09 — Testing

## Baseline

Required before merge:

```bash
go test ./...
```

## Test locations

| Area | Location |
|------|----------|
| Collectors and replay | `internal/collector/*_test.go` |
| HTTP handlers and jobs | `internal/server/*_test.go` |
| Exporters | `internal/exporter/*_test.go` |
| Vendor parsers | `internal/parser/vendors/<vendor>/*_test.go` |

## General rules

- Prefer table-driven tests
- No network access in unit tests
- Cover happy path and realistic failure/partial-data cases
- New vendor parsers need both detection and parse coverage

## Mandatory coverage for dedup/filter/classify logic

Any new deduplication, filtering, or classification function must have:

1. A true-positive case
2. A true-negative case
3. A regression case for the vendor or topology that motivated the change

This is mandatory for inventory logic, firmware filtering, and similar code paths where silent data drift is likely.

## Mandatory coverage for expensive path selection

Any function that decides whether to crawl or probe an expensive path must have:

1. A positive selection case
2. A negative exclusion case
3. A topology-level count/integration case

The goal is to catch runaway I/O regressions before they ship.

## Useful focused commands

```bash
go test ./internal/exporter/...
go test ./internal/collector/...
go test ./internal/server/...
go test ./internal/parser/vendors/...
```
