test: add comprehensive Go test suite with ~75% coverage

New test files:
- config/config_test.go (100% coverage)
- constants/constants_test.go (100% coverage)
- httputil/response_test.go (100% coverage)
- validation/rules_test.go (91.9% coverage)
- middleware/logger_test.go, security_test.go, security_logger_test.go
- handlers/errors_test.go

Updated documentation:
- doc/27-GO-TESTING.md: Complete testing guide
- doc/00-GO-DOCUMENTATION-INDEX.md: Added testing section
- doc/01-ARCHITECTURE.md: Updated package structure
- doc/DECISIONS.md: Added ADR-004 caching decision
- PROJECT-MEMORY.md: Added Go testing section
This commit is contained in:
juanatsap
2025-12-06 17:51:20 +00:00
parent 6ed6c7780b
commit 69012bb1ae
16 changed files with 3900 additions and 865 deletions
+23 -2
View File
@@ -29,6 +29,13 @@ This documentation covers the core Go systems that power the CV site, with a foc
- Protected endpoints and authentication
- API request/response formats
4. **[Go Testing](27-GO-TESTING.md)** (~450 lines)
- Coverage summary by package (100% for config, constants, httputil)
- Test file descriptions and locations
- Testing patterns (table-driven, HTTP handlers, middleware)
- Coverage gap explanations
- Best practices and CI/CD integration
## Quick Navigation
### By Feature
@@ -54,6 +61,14 @@ This documentation covers the core Go systems that power the CV site, with a foc
- [PDF Export](26-GO-ROUTES-API.md#exportpdf---pdf-export)
- [Security Features](26-GO-ROUTES-API.md#security-features)
**Testing:**
- [Coverage Summary](27-GO-TESTING.md#coverage-summary)
- [Test Files](27-GO-TESTING.md#test-files)
- [Running Tests](27-GO-TESTING.md#running-tests)
- [Test Patterns](27-GO-TESTING.md#test-patterns)
- [Coverage Gaps](27-GO-TESTING.md#coverage-gaps)
- [Best Practices](27-GO-TESTING.md#best-practices)
### By Use Case
**Setting Up Validation:**
@@ -71,6 +86,11 @@ This documentation covers the core Go systems that power the CV site, with a foc
2. [Register handlers](26-GO-ROUTES-API.md#route-table)
3. [Apply security](26-GO-ROUTES-API.md#route-specific-middleware)
**Writing Tests:**
1. [Review existing coverage](27-GO-TESTING.md#coverage-summary)
2. [Follow test patterns](27-GO-TESTING.md#test-patterns)
3. [Run and verify](27-GO-TESTING.md#running-tests)
## System Architecture
### Overall Flow
@@ -367,6 +387,7 @@ cv/
│ ├── 24-GO-VALIDATION-SYSTEM.md # Validation docs
│ ├── 25-GO-TEMPLATE-SYSTEM.md # Template docs
│ ├── 26-GO-ROUTES-API.md # Routes/API docs
│ ├── 27-GO-TESTING.md # Testing & coverage
│ └── 00-GO-DOCUMENTATION-INDEX.md # This file
├── internal/
@@ -473,5 +494,5 @@ This documentation is part of the CV site project.
---
**Last Updated:** December 6, 2025
**Total Documentation:** 2,836+ lines across 3 files
**Coverage:** Validation, Templates, Routes, Middleware, Security
**Total Documentation:** 3,300+ lines across 4 files
**Coverage:** Validation, Templates, Routes, Middleware, Security, Testing