From ba2df7d6cc52096c04cf4551f30e0cf64f0c3aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nils=20m=C3=A5s=C3=A9n?= Date: Sat, 14 Oct 2023 12:32:19 +0200 Subject: [PATCH] add buildfilter test --- pkg/filters/filters_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/filters/filters_test.go b/pkg/filters/filters_test.go index ec4e3e785..db5909515 100644 --- a/pkg/filters/filters_test.go +++ b/pkg/filters/filters_test.go @@ -138,6 +138,21 @@ func TestFilterByNoneScope(t *testing.T) { container.AssertExpectations(t) } +func TestTestBuildFilterNoneScope(t *testing.T) { + filter, desc := BuildFilter(nil, nil, false, "none") + + assert.Contains(t, desc, "without a scope") + + scoped := new(mocks.FilterableContainer) + scoped.On("Scope").Return("anyscope", true) + + unscoped := new(mocks.FilterableContainer) + unscoped.On("Scope").Return("", false) + + assert.False(t, filter(scoped)) + assert.True(t, filter(unscoped)) +} + func TestFilterByDisabledLabel(t *testing.T) { filter := FilterByDisabledLabel(NoFilter) assert.NotNil(t, filter)