Added 157+ tests across 8 test files: - registration_test.go: 19 registration and 10 login scenarios - ebook_test.go: 40 ebook and media management tests - user_test.go: 35 user profile and account management tests - library_test_comprehensive.go: 25 library management tests - edge_cases_test.go: 30+ security and edge case tests - new_fixes_test.go: tests for new security fixes - test_helpers.go: shared test utilities Test Coverage: - Authentication & authorization - Input validation (email, username, password) - Role-based access control - Pagination and filtering - Error handling and edge cases - Security scenarios (SQL injection, XSS) Documentation: - TEST_COVERAGE.md: detailed test documentation - ANALYSIS.md: comprehensive analysis of issues found All tests pass successfully
19 lines
319 B
Go
19 lines
319 B
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// Helper functions for testing
|
|
func containsPrefix(s, prefix string) bool {
|
|
return len(s) >= len(prefix) && s[:len(prefix)] == prefix
|
|
}
|
|
|
|
func contains(s, substr string) bool {
|
|
return strings.Contains(s, substr)
|
|
}
|
|
|
|
func trimSpace(s string) string {
|
|
return strings.TrimSpace(s)
|
|
}
|