forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig_test.go
47 lines (36 loc) · 1.18 KB
/
config_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package types_test
import (
"errors"
"testing"
"github.com/stretchr/testify/suite"
sdk "github.com/cosmos/cosmos-sdk/types"
)
type configTestSuite struct {
suite.Suite
}
func TestConfigTestSuite(t *testing.T) {
suite.Run(t, new(configTestSuite))
}
func (s *configTestSuite) TestConfig_SetTxEncoder() {
mockErr := errors.New("test")
config := sdk.NewConfig()
s.Require().Nil(config.GetTxEncoder())
encFunc := sdk.TxEncoder(func(tx sdk.Tx) ([]byte, error) { return nil, nil })
config.SetTxEncoder(encFunc)
_, err := config.GetTxEncoder()(sdk.Tx(nil))
s.Require().Error(mockErr, err)
config.Seal()
s.Require().Panics(func() { config.SetTxEncoder(encFunc) })
}
func (s *configTestSuite) TestConfig_SetFullFundraiserPath() {
config := sdk.NewConfig()
config.SetFullFundraiserPath("test/path")
s.Require().Equal("test/path", config.GetFullFundraiserPath())
config.SetFullFundraiserPath("test/poth")
s.Require().Equal("test/poth", config.GetFullFundraiserPath())
config.Seal()
s.Require().Panics(func() { config.SetFullFundraiserPath("x/test/path") })
}
func (s *configTestSuite) TestKeyringServiceName() {
s.Require().Equal(sdk.DefaultKeyringServiceName, sdk.KeyringServiceName())
}