github.com/vipernet-xyz/tm@v0.34.24/libs/pubsub/query/empty_test.go (about)

     1  package query_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  
     8  	"github.com/vipernet-xyz/tm/libs/pubsub/query"
     9  )
    10  
    11  func TestEmptyQueryMatchesAnything(t *testing.T) {
    12  	q := query.Empty{}
    13  
    14  	testCases := []struct {
    15  		query map[string][]string
    16  	}{
    17  		{map[string][]string{}},
    18  		{map[string][]string{"Asher": {"Roth"}}},
    19  		{map[string][]string{"Route": {"66"}}},
    20  		{map[string][]string{"Route": {"66"}, "Billy": {"Blue"}}},
    21  	}
    22  
    23  	for _, tc := range testCases {
    24  		match, err := q.Matches(tc.query)
    25  		assert.Nil(t, err)
    26  		assert.True(t, match)
    27  	}
    28  }