You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1020 B

  1. package types
  2. import (
  3. "fmt"
  4. "testing"
  5. "github.com/stretchr/testify/assert"
  6. )
  7. // Verify that the event data types satisfy their shared interface.
  8. var (
  9. _ EventData = EventDataBlockSyncStatus{}
  10. _ EventData = EventDataCompleteProposal{}
  11. _ EventData = EventDataNewBlock{}
  12. _ EventData = EventDataNewBlockHeader{}
  13. _ EventData = EventDataNewEvidence{}
  14. _ EventData = EventDataNewRound{}
  15. _ EventData = EventDataRoundState{}
  16. _ EventData = EventDataStateSyncStatus{}
  17. _ EventData = EventDataTx{}
  18. _ EventData = EventDataValidatorSetUpdates{}
  19. _ EventData = EventDataVote{}
  20. _ EventData = EventDataString("")
  21. )
  22. func TestQueryTxFor(t *testing.T) {
  23. tx := Tx("foo")
  24. assert.Equal(t,
  25. fmt.Sprintf("tm.event = 'Tx' AND tx.hash = '%X'", tx.Hash()),
  26. EventQueryTxFor(tx).String(),
  27. )
  28. }
  29. func TestQueryForEvent(t *testing.T) {
  30. assert.Equal(t,
  31. "tm.event = 'NewBlock'",
  32. QueryForEvent(EventNewBlockValue).String(),
  33. )
  34. assert.Equal(t,
  35. "tm.event = 'NewEvidence'",
  36. QueryForEvent(EventNewEvidenceValue).String(),
  37. )
  38. }