cosmos-sdk/simapp/simd/cmd/cmd_test.go
Matt Kocubinski 184235e1a8
refactor: create go.mod for simapp (#13130)
* Add go.mod for simapp

* creating dep check script

* new version of cosmos-sdk

* tests/ must be a module also if it is to test simapp

* maybe add a github action which should fail

* mv tests/mocks -> testutil/mock

* Refactor usages of tests/mocks

* update build command

* fix rosetta tests

* go mod tidy

* use cosmossdk.io/simapp

* Update sim entrypoints

* use simapp as a module

* go mod tidy

* Add replaced for vuln package

* fix vuln dep

* this CI run should fail

* this CI run should succeed

* use absolute path in makefile
2022-09-07 18:14:22 +00:00

43 lines
1020 B
Go

package cmd_test
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
"cosmossdk.io/simapp"
"cosmossdk.io/simapp/simd/cmd"
"github.com/cosmos/cosmos-sdk/client/flags"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
)
func TestInitCmd(t *testing.T) {
rootCmd := cmd.NewRootCmd()
rootCmd.SetArgs([]string{
"init", // Test the init cmd
"simapp-test", // Moniker
fmt.Sprintf("--%s=%s", cli.FlagOverwrite, "true"), // Overwrite genesis.json, in case it already exists
})
require.NoError(t, svrcmd.Execute(rootCmd, "", simapp.DefaultNodeHome))
}
func TestHomeFlagRegistration(t *testing.T) {
homeDir := "/tmp/foo"
rootCmd := cmd.NewRootCmd()
rootCmd.SetArgs([]string{
"query",
fmt.Sprintf("--%s", flags.FlagHome),
homeDir,
})
require.NoError(t, svrcmd.Execute(rootCmd, "", simapp.DefaultNodeHome))
result, err := rootCmd.Flags().GetString(flags.FlagHome)
require.NoError(t, err)
require.Equal(t, result, homeDir)
}