Skip to content

Commit

Permalink
test: increase code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
okwme committed Jul 14, 2021
1 parent 7756fcb commit 03cfa8b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/gaiad/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
WithLegacyAmino(encodingConfig.Amino).
WithInput(os.Stdin).
WithAccountRetriever(types.AccountRetriever{}).
WithHomeDir(gaia.DefaultNodeHome)
WithHomeDir(gaia.DefaultNodeHome).
WithViper("")

rootCmd := &cobra.Command{
Use: "gaiad",
Expand Down
23 changes: 23 additions & 0 deletions cmd/gaiad/cmd/root_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd_test

import (
"testing"

svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"

app "github.com/cosmos/gaia/v5/app"
"github.com/cosmos/gaia/v5/cmd/gaiad/cmd"
"github.com/stretchr/testify/require"
)

func TestRootCmdConfig(t *testing.T) {

rootCmd, _ := cmd.NewRootCmd()
rootCmd.SetArgs([]string{
"config", // Test the config cmd
"keyring-backend", // key
"test", // value
})

require.NoError(t, svrcmd.Execute(rootCmd, app.DefaultNodeHome))
}

0 comments on commit 03cfa8b

Please sign in to comment.