test: add comprehensive test suite covering all failure points
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
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user