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.

35 lines
755 B

  1. package coretypes
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. "github.com/tendermint/tendermint/types"
  6. )
  7. func TestStatusIndexer(t *testing.T) {
  8. var status *ResultStatus
  9. assert.False(t, status.TxIndexEnabled())
  10. status = &ResultStatus{}
  11. assert.False(t, status.TxIndexEnabled())
  12. status.NodeInfo = types.NodeInfo{}
  13. assert.False(t, status.TxIndexEnabled())
  14. cases := []struct {
  15. expected bool
  16. other types.NodeInfoOther
  17. }{
  18. {false, types.NodeInfoOther{}},
  19. {false, types.NodeInfoOther{TxIndex: "aa"}},
  20. {false, types.NodeInfoOther{TxIndex: "off"}},
  21. {true, types.NodeInfoOther{TxIndex: "on"}},
  22. }
  23. for _, tc := range cases {
  24. status.NodeInfo.Other = tc.other
  25. assert.Equal(t, tc.expected, status.TxIndexEnabled())
  26. }
  27. }