test: add new handler test files for analytics, auth, kobo, library, progress, and sidecar
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestParseTokenUUID_ValidUUID(t *testing.T) {
|
||||
validUUID := "550e8400-e29b-41d4-a716-446655440000"
|
||||
|
||||
result, err := parseTokenUUID(validUUID)
|
||||
|
||||
require.NoError(t, err)
|
||||
assert.True(t, result.Valid)
|
||||
}
|
||||
|
||||
func TestParseTokenUUID_InvalidUUID(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
input string
|
||||
}{
|
||||
{"not a uuid", "not-a-valid-jwt-token"},
|
||||
{"empty string", ""},
|
||||
{"invalid format", "550e8400-e29b-41d4"},
|
||||
{"too short", "abc"},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
_, err := parseTokenUUID(tt.input)
|
||||
assert.Error(t, err)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user