package server import ( "testing" "git.breakpilot.com/platform/tenant-registry/internal/store" ) func TestOverdueStep(t *testing.T) { s := &Server{} for _, c := range []struct { status string dunned bool days int next string ok bool }{ {"active", false, 0, "warning", true}, {"trial", false, 0, "warning", true}, // no Mahnung: never past warning, however long overdue (AGB ยง 10) {"warning", false, 90, "", false}, {"active", true, 13, "warning", true}, {"active", true, 14, "restricted", true}, {"warning", true, 14, "restricted", true}, // a Mahnung never halts directly: read-only first, the timer halts {"restricted", true, 40, "", false}, {"active", true, 40, "restricted", true}, {"warning", true, 40, "restricted", true}, {"warning", true, 2, "", false}, {"demo", true, 40, "", false}, {"halted", true, 40, "", false}, } { next, ok := s.overdueStep(&store.Tenant{Status: c.status}, c.dunned, c.days) if next != c.next || ok != c.ok { t.Errorf("%s dunned=%v %d days: %q %v, want %q %v", c.status, c.dunned, c.days, next, ok, c.next, c.ok) } } }