# Test Strategy GeoIntel is data-heavy. Tests must focus on contracts, geospatial correctness, and regression safety. ## Test layers ### 1. Unit tests Backend: - Geometry validation. - Area calculation. - Dataset metadata extraction wrappers. - Analysis formulas. - QA/QC metrics. Frontend: - API client methods. - Basic component rendering. - Empty/loading/error states. ### 2. Integration tests - FastAPI endpoint + database session. - Project CRUD. - Area creation with valid GeoJSON. - Dataset metadata refresh with fixture files. - Vector clipping using small fixture polygons. - QA/QC using fixture detection/reference polygons. ### 3. Smoke tests Minimum commands: ```bash # backend pytest # frontend npm run build npm run lint ``` ### 4. Geospatial correctness tests Use small deterministic fixtures: - One AOI polygon. - Three building polygons. - Two detection polygons. - Known intersection results. - Expected precision/recall/F1. No huge geospatial datasets in the repo. ## Fixtures Place lightweight fixtures in: ```text tests/fixtures/ geojson/ rasters/ vectors/ ``` Large datasets are not committed. Document download/setup in `docs/FIXTURE_STRATEGY.md`. ## Required V1 acceptance tests - Create project. - Create area from GeoJSON. - Upload or register vector fixture. - Extract vector metadata. - Calculate building stats. - Create fake detection fixture through service/test-only path. - Run QA/QC against reference polygons. - Export QA output as GeoJSON or JSON. ## Regression rules - Do not remove existing tests to make a pass green. - When an endpoint changes, update API contract and frontend client together. - If a feature is stubbed because dependency is unavailable, it must return an explicit `not_configured` state, not silent success.