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.

39 lines
973 B

  1. package null
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/stretchr/testify/assert"
  6. "github.com/tendermint/tendermint/state/indexer"
  7. "github.com/tendermint/tendermint/types"
  8. )
  9. func TestNullEventSink(t *testing.T) {
  10. nullIndexer := NewEventSink()
  11. assert.Nil(t, nullIndexer.IndexTxEvents(nil))
  12. assert.Nil(t, nullIndexer.IndexBlockEvents(types.EventDataNewBlockHeader{}))
  13. val1, err1 := nullIndexer.SearchBlockEvents(context.TODO(), nil)
  14. assert.Nil(t, val1)
  15. assert.Nil(t, err1)
  16. val2, err2 := nullIndexer.SearchTxEvents(context.TODO(), nil)
  17. assert.Nil(t, val2)
  18. assert.Nil(t, err2)
  19. val3, err3 := nullIndexer.GetTxByHash(nil)
  20. assert.Nil(t, val3)
  21. assert.Nil(t, err3)
  22. val4, err4 := nullIndexer.HasBlock(0)
  23. assert.False(t, val4)
  24. assert.Nil(t, err4)
  25. }
  26. func TestType(t *testing.T) {
  27. nullIndexer := NewEventSink()
  28. assert.Equal(t, indexer.NULL, nullIndexer.Type())
  29. }
  30. func TestStop(t *testing.T) {
  31. nullIndexer := NewEventSink()
  32. assert.Nil(t, nullIndexer.Stop())
  33. }