| 1 | package completion |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestNeedsAttentionMatrix(t *testing.T) { |
| 6 | tests := []struct { |
| 7 | name string |
| 8 | in AttentionInput |
| 9 | want bool |
| 10 | }{ |
| 11 | {name: "scratch or quiet standard", in: AttentionInput{Verdict: "uncertain"}, want: false}, |
| 12 | {name: "standard unreviewed", in: AttentionInput{Verdict: "partial", GapKinds: []string{"unreviewed_change"}}, want: false}, |
| 13 | {name: "standard unverified", in: AttentionInput{Verdict: "partial", GapKinds: []string{"unverified_change"}}, want: false}, |
| 14 | {name: "delivery unverified", in: AttentionInput{Verdict: "partial", Floor: "delivery", GapKinds: []string{"unverified_change"}}, want: true}, |
| 15 | {name: "failed test", in: AttentionInput{Verdict: "partial", GapKinds: []string{"failed_verification"}}, want: true}, |
| 16 | {name: "blocked", in: AttentionInput{Verdict: "blocked"}, want: true}, |
| 17 | {name: "failed check count", in: AttentionInput{ChecksFailed: 1}, want: true}, |
| 18 | {name: "unbacked claim", in: AttentionInput{GapKinds: []string{"unbacked_claim"}}, want: true}, |
| 19 | {name: "required suppressed", in: AttentionInput{RequiredSuppressed: true}, want: true}, |
| 20 | } |
| 21 | for _, tt := range tests { |
| 22 | t.Run(tt.name, func(t *testing.T) { |
| 23 | if got := NeedsAttention(tt.in); got != tt.want { |
| 24 | t.Fatalf("NeedsAttention(%+v) = %v, want %v", tt.in, got, tt.want) |
| 25 | } |
| 26 | }) |
| 27 | } |
| 28 | } |
| 29 |