Files
TradarrV2/backend/internal/models/preferences_test.go
Blomios 50bde816ed feat(accounts): add admin accounts and user preferences
Remove public registration, support administrator-managed accounts, and persist personal preferences.

Refs #2 #5

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-20 19:54:06 +01:00

19 lines
578 B
Go

package models
import (
"github.com/gin-gonic/gin/binding"
"testing"
)
func TestPreferencesValidation(t *testing.T) {
for _, language := range []string{"fr", "en", "de", "", "FR"} {
for _, mode := range []string{"title", "title_content", "unknown", ""} {
p := UserPreferences{Language: language, RankingMode: mode}
wantValid := (language == "fr" || language == "en") && (mode == "title" || mode == "title_content")
if err := binding.Validator.ValidateStruct(p); (err == nil) != wantValid {
t.Fatalf("%+v: valid=%v error=%v", p, wantValid, err)
}
}
}
}