package probe import ( "testing" "supply-intelligence/internal/domain" ) func TestNextAccountStatus_DoesNotDisableFromPendingStatesOnExplicitFailure(t *testing.T) { tests := []struct { name string current domain.AccountStatus }{ {name: "pending verify stays pending verify", current: domain.AccountStatusPendingVerify}, {name: "pending enable stays pending enable", current: domain.AccountStatusPendingEnable}, {name: "disabled stays disabled", current: domain.AccountStatusDisabled}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := NextAccountStatus(tt.current, domain.ProbeClassificationExplicitFailure, 1) if got != tt.current { t.Fatalf("unexpected transition: got %q want %q", got, tt.current) } }) } } func TestNextAccountStatus_SuccessAlwaysRecoversToActive(t *testing.T) { tests := []domain.AccountStatus{ domain.AccountStatusSuspended, domain.AccountStatusDisabled, domain.AccountStatusPendingVerify, domain.AccountStatusPendingEnable, } for _, current := range tests { t.Run(string(current), func(t *testing.T) { got := NextAccountStatus(current, domain.ProbeClassificationSuccess, 0) if got != domain.AccountStatusActive { t.Fatalf("unexpected success transition from %q: got %q", current, got) } }) } } func TestNextAccountStatus_InconclusiveDoesNotAdvanceFailureThreshold(t *testing.T) { got := NextAccountStatus(domain.AccountStatusSuspended, domain.ProbeClassificationInconclusive, 2) if got != domain.AccountStatusSuspended { t.Fatalf("unexpected transition after inconclusive: got %q want %q", got, domain.AccountStatusSuspended) } }