github.com/everdrone/grab@v0.1.7-0.20230416223925-40674b995521/cmd/config_test.go (about) 1 package cmd 2 3 import ( 4 "strings" 5 "testing" 6 7 tu "github.com/everdrone/grab/testutils" 8 ) 9 10 func TestConfigCmd(t *testing.T) { 11 t.Run("prints help message", func(tc *testing.T) { 12 c, got, err := tu.ExecuteCommand(RootCmd, "config") 13 14 if err != nil { 15 tc.Fatal(err) 16 } 17 18 if c.Name() != ConfigCmd.Name() { 19 tc.Fatalf("got: '%s', want: '%s'", c.Name(), ConfigCmd.Name()) 20 } 21 22 if !strings.HasPrefix(got, ConfigCmd.Short) { 23 tc.Errorf("got: '%s', want: '%s'", got, ConfigCmd.Short) 24 } 25 }) 26 }