From a3af75c7d7590d494b07ddbed85952961e485b68 Mon Sep 17 00:00:00 2001 From: Theresa Gresch Date: Sun, 2 Feb 2020 13:02:40 +0100 Subject: [PATCH] Test: Add test for invalid query to query/label.go --- internal/query/label_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/internal/query/label_test.go b/internal/query/label_test.go index 0c96a3b6b..41c6c0d50 100644 --- a/internal/query/label_test.go +++ b/internal/query/label_test.go @@ -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) + }) }