31 lines
1.2 KiB
Go
31 lines
1.2 KiB
Go
package probe
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"supply-intelligence/internal/domain"
|
|
)
|
|
|
|
func TestNextAccountStatus(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
current domain.AccountStatus
|
|
classification domain.ProbeClassification
|
|
want domain.AccountStatus
|
|
}{
|
|
{name: "success keeps active", current: domain.AccountStatusActive, classification: domain.ProbeClassificationSuccess, want: domain.AccountStatusActive},
|
|
{name: "explicit failure active to suspended", current: domain.AccountStatusActive, classification: domain.ProbeClassificationExplicitFailure, want: domain.AccountStatusSuspended},
|
|
{name: "explicit failure suspended to disabled", current: domain.AccountStatusSuspended, classification: domain.ProbeClassificationExplicitFailure, want: domain.AccountStatusDisabled},
|
|
{name: "inconclusive keeps active", current: domain.AccountStatusActive, classification: domain.ProbeClassificationInconclusive, want: domain.AccountStatusActive},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got := NextAccountStatus(tt.current, tt.classification)
|
|
if got != tt.want {
|
|
t.Fatalf("status mismatch: got %q want %q", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|