github.com/number571/tendermint@v0.34.11-gost/libs/pubsub/query/empty_test.go (about) 1 package query_test 2 3 import ( 4 "testing" 5 6 abci "github.com/number571/tendermint/abci/types" 7 "github.com/number571/tendermint/libs/pubsub/query" 8 "github.com/stretchr/testify/require" 9 ) 10 11 func TestEmptyQueryMatchesAnything(t *testing.T) { 12 q := query.Empty{} 13 14 testCases := []struct { 15 events []abci.Event 16 }{ 17 { 18 []abci.Event{}, 19 }, 20 { 21 []abci.Event{ 22 { 23 Type: "Asher", 24 Attributes: []abci.EventAttribute{{Key: "Roth"}}, 25 }, 26 }, 27 }, 28 { 29 []abci.Event{ 30 { 31 Type: "Route", 32 Attributes: []abci.EventAttribute{{Key: "66"}}, 33 }, 34 }, 35 }, 36 { 37 []abci.Event{ 38 { 39 Type: "Route", 40 Attributes: []abci.EventAttribute{{Key: "66"}}, 41 }, 42 { 43 Type: "Billy", 44 Attributes: []abci.EventAttribute{{Key: "Blue"}}, 45 }, 46 }, 47 }, 48 } 49 50 for _, tc := range testCases { 51 match, err := q.Matches(tc.events) 52 require.Nil(t, err) 53 require.True(t, match) 54 } 55 }