package cli //nolint:testpackage // exercises the unexported command constructor import ( "testing" "github.com/spf13/cobra" "github.com/stretchr/testify/assert" ) // TestJSONHelpSaysConfirmationPromptIsSkipped checks that the --json help // of `snapshot remove` and `prune` says the flag skips the confirmation // prompt. Both delete without asking under --json, since a prompt on // stdout would break the JSON document. func TestJSONHelpSaysConfirmationPromptIsSkipped(t *testing.T) { t.Parallel() for name, cmd := range map[string]*cobra.Command{ "snapshot remove": newSnapshotRemoveCommand(), "prune": NewPruneCommand(), } { assert.Contains(t, cmd.Flags().Lookup("json").Usage, "skips the confirmation prompt", name) } }