+func TestMatchesApiIds(t *testing.T) {
+ apiId := "apiId"
+ apiIds := []string{apiId, "otherApiId"}
+ eventFilters := []eventsapi.CAPIFEventFilter{
+ {},
+ {
+ ApiIds: &apiIds,
+ },
+ }
+
+ eventApiIds := []string{apiId}
+ assert.True(t, matchesApiIds(eventApiIds, eventFilters))
+ assert.True(t, matchesApiIds(nil, eventFilters))
+
+ altApiIds := []string{"anotherApiId"}
+ unMatchingFilterAdded := append(eventFilters, eventsapi.CAPIFEventFilter{
+ ApiIds: &altApiIds,
+ })
+ assert.False(t, matchesApiIds(eventApiIds, unMatchingFilterAdded))
+
+ apiIds[0] = "anotherId"
+ assert.False(t, matchesApiIds(eventApiIds, eventFilters))
+}
+