Skip to content

Commit

Permalink
fixed typo and added one more test case
Browse files Browse the repository at this point in the history
  • Loading branch information
sio4 committed Jun 30, 2022
1 parent 4f498f4 commit 3abf892
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion soda/cmd/root_integration_test.go
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require"
)

func Test_RootCmd_Environtment(t *testing.T) {
func Test_RootCmd_Environment(t *testing.T) {
oldEnv := os.Getenv("GO_ENV")
defer os.Setenv("GO_ENV", oldEnv)

Expand All @@ -27,6 +27,18 @@ func Test_RootCmd_Environtment(t *testing.T) {
r.NoError(err)
r.Equal("test", env)

// CLI flag priority: the preferred order of flags and commands
c.SetArgs([]string{
"--env",
"production",
"help",
})
os.Setenv("GO_ENV", "test")
err = c.Execute()
r.NoError(err)
r.Equal("production", env)

// the following order works fine now but need to be considered again
// CLI flag priority
c.SetArgs([]string{
"help",
Expand Down

0 comments on commit 3abf892

Please sign in to comment.