test: cover initial recommend fallback inputs
- add coverage for leading-dot recommendation inputs - verify normal recommendation inputs do not fallback to initial suggestions
This commit is contained in:
parent
d8668afa46
commit
180b0f7843
|
|
@ -99,3 +99,28 @@ func TestFallbackSpecificSetKey(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestShouldFallbackToInitialRecommend(t *testing.T) {
|
||||
tests := []struct {
|
||||
input string
|
||||
want bool
|
||||
}{
|
||||
{input: "", want: false},
|
||||
{input: ".", want: true},
|
||||
{input: ".x", want: true},
|
||||
{input: "..x", want: true},
|
||||
{input: "...x", want: true},
|
||||
{input: "grid000", want: false},
|
||||
{input: "grid000.", want: false},
|
||||
{input: "grid000.zone000", want: false},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.input, func(t *testing.T) {
|
||||
got := shouldFallbackToInitialRecommend(tt.input)
|
||||
if got != tt.want {
|
||||
t.Fatalf("expected %t, got %t", tt.want, got)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue