diff --git a/pkg/filters/filters_test.go b/pkg/filters/filters_test.go index ec4e3e785..2b5cb5e70 100644 --- a/pkg/filters/filters_test.go +++ b/pkg/filters/filters_test.go @@ -138,6 +138,26 @@ func TestFilterByNoneScope(t *testing.T) { container.AssertExpectations(t) } +func TestBuildFilterNoneScope(t *testing.T) { + filter, desc := BuildFilter(nil, nil, false, "none") + + assert.Contains(t, desc, "without a scope") + + scoped := new(mocks.FilterableContainer) + scoped.On("Enabled").Return(false, false) + scoped.On("Scope").Return("anyscope", true) + + unscoped := new(mocks.FilterableContainer) + unscoped.On("Enabled").Return(false, false) + unscoped.On("Scope").Return("", false) + + assert.False(t, filter(scoped)) + assert.True(t, filter(unscoped)) + + scoped.AssertExpectations(t) + unscoped.AssertExpectations(t) +} + func TestFilterByDisabledLabel(t *testing.T) { filter := FilterByDisabledLabel(NoFilter) assert.NotNil(t, filter)