Test: Add test for invalid query to query/label.go
This commit is contained in:
parent
9069d1312c
commit
a3af75c7d7
1 changed files with 14 additions and 0 deletions
|
@ -112,4 +112,18 @@ func TestRepo_Labels(t *testing.T) {
|
|||
assert.Equal(t, "Flower", result[1].LabelName)
|
||||
assert.Equal(t, "COW", result[0].LabelName)
|
||||
})
|
||||
|
||||
t.Run("search with empty query", func(t *testing.T) {
|
||||
query := form.NewLabelSearch("")
|
||||
result, err := search.Labels(query)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 3, len(result))
|
||||
})
|
||||
|
||||
t.Run("search with invalid query string", func(t *testing.T) {
|
||||
query := form.NewLabelSearch("xxx:bla")
|
||||
result, err := search.Labels(query)
|
||||
assert.Error(t, err, "unknown filter")
|
||||
t.Log(result)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue