(t *testing.T)
| 6 | ) |
| 7 | |
| 8 | func TestSuggestValue(t *testing.T) { |
| 9 | tests := []struct { |
| 10 | name string |
| 11 | input string |
| 12 | valid []string |
| 13 | expected string |
| 14 | }{ |
| 15 | {"exact match", "pending", validStatusValues, "pending"}, |
| 16 | {"close typo", "pening", validStatusValues, "pending"}, |
| 17 | {"complted -> completed", "complted", validStatusValues, "completed"}, |
| 18 | {"hig -> high", "hig", validPriorityValues, "high"}, |
| 19 | {"medim -> medium", "medim", validPriorityValues, "medium"}, |
| 20 | {"smal -> small", "smal", validEffortValues, "small"}, |
| 21 | {"totally wrong", "zzzzzzzzz", validStatusValues, ""}, |
| 22 | {"case insensitive", "PENDING", validStatusValues, "pending"}, |
| 23 | } |
| 24 | |
| 25 | for _, tt := range tests { |
| 26 | t.Run(tt.name, func(t *testing.T) { |
| 27 | got := suggestValue(tt.input, tt.valid) |
| 28 | if got != tt.expected { |
| 29 | t.Errorf("suggestValue(%q) = %q, want %q", tt.input, got, tt.expected) |
| 30 | } |
| 31 | }) |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | func TestInvalidValueError_WithSuggestion(t *testing.T) { |
| 36 | err := invalidValueError("status", "pening", validStatusValues) |
nothing calls this directly
no test coverage detected