Skip to content

Commit 8c76573

Browse files
committed
added test for pretty-flag presence
1 parent 5027733 commit 8c76573

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

cmd/os-image-composer/inspect_cmd_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,19 @@ func TestCreateInspectCommand(t *testing.T) {
8383
}
8484
})
8585

86+
t.Run("CommandFlags", func(t *testing.T) {
87+
formatFlag := cmd.Flags().Lookup("pretty")
88+
if formatFlag == nil {
89+
t.Fatal("--pretty flag should be registered")
90+
}
91+
if formatFlag.DefValue != "false" {
92+
t.Errorf("--pretty default should be 'false', got %q", formatFlag.DefValue)
93+
}
94+
if formatFlag.Usage == "" {
95+
t.Error("--pretty should have usage text")
96+
}
97+
})
98+
8699
t.Run("ArgsValidation", func(t *testing.T) {
87100
if cmd.Args == nil {
88101
t.Fatal("Args validator should be set")

0 commit comments

Comments
 (0)