check / check (push) Waiting to run
snapshot remove and prune delete without asking under --json, because a prompt on stdout would break the JSON document. Their --json help and README entries named only --force as skipping the prompt. Both now say --json skips it too. A test checks the --json help of both commands. Model: opus-5-5
25 lines
712 B
Go
25 lines
712 B
Go
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 _, cmd := range []*cobra.Command{
|
|
newSnapshotRemoveCommand(),
|
|
NewPruneCommand(),
|
|
} {
|
|
assert.Contains(t, cmd.Flags().Lookup("json").Usage,
|
|
"skips the confirmation prompt", cmd.Name())
|
|
}
|
|
}
|