selector: add filters to replace depricated client/selector filters (#1785)

This commit is contained in:
ben-toogood
2020-07-02 16:09:48 +01:00
committed by GitHub
parent d577dd6abe
commit 6898a65508
7 changed files with 86 additions and 91 deletions

View File

@@ -32,6 +32,18 @@ func Tests(t *testing.T, s Selector) {
t.Errorf("Expected the route to be one of the inputs")
}
})
t.Run("Filters", func(t *testing.T) {
var filterApplied bool
filter := func(rts []router.Route) []router.Route {
filterApplied = true
return rts
}
_, err := s.Select([]router.Route{r1, r2}, WithFilter(filter))
assert.Nil(t, err, "Error should be nil")
assert.True(t, filterApplied, "Filters should be applied")
})
})
t.Run("Record", func(t *testing.T) {