cosmos-sdk/client/context/verifier_test.go
Alexander Bezobchuk c1991e31bd Merge PR #5527: Bump Tendermint Version to v0.33.0
* Bump Tendermint version to v0.33.0

* Deprecate old cmn package with new packages

* Update update DB APIs

* More DB updates

* Bump IAVL to v0.13.0

* Handle error returned by iavl.NewMutableTree

* Fix some IAVL stuffs

* Update IAVL

* More updates

* Passing tests

* Fix unit tests

Co-authored-by: Jack Zampolin <jack.zampolin@gmail.com>
2020-01-16 13:46:51 -08:00

38 lines
856 B
Go

package context_test
import (
"io/ioutil"
"testing"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/client/context"
)
func TestCreateVerifier(t *testing.T) {
tmpDir, err := ioutil.TempDir("", "example")
require.NoError(t, err)
testCases := []struct {
name string
ctx context.CLIContext
expectErr bool
}{
{"no chain ID", context.CLIContext{}, true},
{"no home directory", context.CLIContext{}.WithChainID("test"), true},
{"no client or RPC URI", context.CLIContext{HomeDir: tmpDir}.WithChainID("test"), true},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
verifier, err := context.CreateVerifier(tc.ctx, context.DefaultVerifierCacheSize)
require.Equal(t, tc.expectErr, err != nil, err)
if !tc.expectErr {
require.NotNil(t, verifier)
}
})
}
}