gohorsejobs/backend/internal/api/middleware
Tiago Yamamoto 052f5169c5 test(auth): add comprehensive auth tests with 98.6% coverage
Backend Tests Added:
- auth_middleware_test.go: 25+ tests for HeaderAuthGuard, OptionalHeaderAuthGuard, RequireRoles, TenantGuard, ExtractRoles, hasRole (100% coverage)
- cors_middleware_test.go: 7 tests for CORS origin validation (100% coverage)
- jwt_service_test.go: expanded with expiration parsing, wrong signing method tests (94.4% coverage)

Features:
- Maximum console.log/fmt.Printf output for debugging
- Tests for JWT from header and cookie fallback
- Tests for role-based access (case-insensitive)
- Tests for tenant enforcement
- Tests for token expiration parsing (7d, 2h, invalid formats)

Total backend auth coverage: 98.6%
2025-12-24 16:20:56 -03:00
..
auth_middleware.go debug(auth): add detailed logging to HeaderAuthGuard middleware 2025-12-24 15:14:46 -03:00
auth_middleware_test.go test(auth): add comprehensive auth tests with 98.6% coverage 2025-12-24 16:20:56 -03:00
cors_middleware.go first commit 2025-12-09 19:04:48 -03:00
cors_middleware_test.go test(auth): add comprehensive auth tests with 98.6% coverage 2025-12-24 16:20:56 -03:00