github.com/aakash4dev/cometbft@v0.38.2/types/events_test.go (about)

     1  package types
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestQueryTxFor(t *testing.T) {
    11  	tx := Tx("foo")
    12  	assert.Equal(t,
    13  		fmt.Sprintf("tm.event = 'Tx' AND tx.hash = '%X'", tx.Hash()),
    14  		EventQueryTxFor(tx).String(),
    15  	)
    16  }
    17  
    18  func TestQueryForEvent(t *testing.T) {
    19  	assert.Equal(t,
    20  		"tm.event = 'NewBlock'",
    21  		QueryForEvent(EventNewBlock).String(),
    22  	)
    23  	assert.Equal(t,
    24  		"tm.event = 'NewEvidence'",
    25  		QueryForEvent(EventNewEvidence).String(),
    26  	)
    27  }