test: add new handler test files for analytics, auth, kobo, library, progress, and sidecar

This commit is contained in:
2026-02-14 21:38:08 -05:00
parent acd194c217
commit 6346e9bc27
7 changed files with 362 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
package handlers
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestLooksLikeSHA256_Valid(t *testing.T) {
validSHA256 := "550e8400e29b41d4a716446655440000550e8400e29b41d4a716446655440000"
result := looksLikeSHA256(validSHA256)
assert.True(t, result)
}
func TestLooksLikeSHA256_Lowercase(t *testing.T) {
sha256 := "550e8400e29b41d4a716446655440000550e8400e29b41d4a716446655440000"
result := looksLikeSHA256(sha256)
assert.True(t, result)
}
func TestLooksLikeSHA256_Invalid(t *testing.T) {
tests := []struct {
name string
input string
}{
{"too short", "abc123"},
{"too long", "550e8400e29b41d4a716446655440000550e8400e29b41d4a71644665544000000"},
{"wrong characters", "550e8400e29b41d4a716446655440000550e8400e29b41d4a71644665544000gg"},
{"empty", ""},
{"with spaces", "550e8400 e29b 41d4 a716 446655440000"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := looksLikeSHA256(tt.input)
assert.False(t, result)
})
}
}