MCPcopy Create free account
hub / github.com/driangle/taskmd / TestSuggestValue

Function TestSuggestValue

apps/cli/internal/cli/suggest_test.go:8–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func 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
35func TestInvalidValueError_WithSuggestion(t *testing.T) {
36 err := invalidValueError("status", "pening", validStatusValues)

Callers

nothing calls this directly

Calls 1

suggestValueFunction · 0.85

Tested by

no test coverage detected