Skip to content

Commit

Permalink
add buildfilter test
Browse files Browse the repository at this point in the history
  • Loading branch information
piksel committed Oct 14, 2023
1 parent f309ad4 commit e539199
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/filters/filters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e539199

Please sign in to comment.