package services import ( "testing" "github.com/breakpilot/school-service/internal/models" ) func TestUpsertSchoolCalendarConfigRequest_Validation(t *testing.T) { tests := []struct { name string req models.UpsertSchoolCalendarConfigRequest wantErr bool }{ {"valid NI", models.UpsertSchoolCalendarConfigRequest{Bundesland: "DE-NI"}, false}, {"empty bundesland", models.UpsertSchoolCalendarConfigRequest{Bundesland: ""}, true}, {"too long", models.UpsertSchoolCalendarConfigRequest{Bundesland: "DE-NIE"}, true}, {"too short", models.UpsertSchoolCalendarConfigRequest{Bundesland: "DE"}, true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if (validate.Struct(tt.req) != nil) != tt.wantErr { t.Errorf("unexpected validation outcome for %s", tt.name) } }) } } func TestCreateSchoolEventRequest_Validation(t *testing.T) { tests := []struct { name string req models.CreateSchoolEventRequest wantErr bool }{ {"valid fortbildung", models.CreateSchoolEventRequest{ Title: "SCHILF", EventType: "fortbildung", StartDate: "2026-10-01", EndDate: "2026-10-01", }, false}, {"missing title", models.CreateSchoolEventRequest{ EventType: "fortbildung", StartDate: "2026-10-01", EndDate: "2026-10-01", }, true}, {"invalid event type", models.CreateSchoolEventRequest{ Title: "X", EventType: "wedding", StartDate: "2026-10-01", EndDate: "2026-10-01", }, true}, {"missing dates", models.CreateSchoolEventRequest{ Title: "X", EventType: "schulfeier", }, true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if (validate.Struct(tt.req) != nil) != tt.wantErr { t.Errorf("unexpected validation outcome for %s", tt.name) } }) } } func TestNewCalendarService_Constructs(t *testing.T) { s := NewCalendarService(nil) if s == nil { t.Fatal("expected non-nil service") } }