MCPcopy Index your code
hub / github.com/cli/cli / TestNewCmdDelete

Function TestNewCmdDelete

pkg/cmd/gist/delete/delete_test.go:24–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22)
23
24func TestNewCmdDelete(t *testing.T) {
25 tests := []struct {
26 name string
27 cli string
28 tty bool
29 want DeleteOptions
30 wantErr bool
31 wantErrMsg string
32 }{
33 {
34 name: "valid selector",
35 cli: "123",
36 tty: true,
37 want: DeleteOptions{
38 Selector: "123",
39 },
40 },
41 {
42 name: "valid selector, no ID supplied",
43 cli: "",
44 tty: true,
45 want: DeleteOptions{
46 Selector: "",
47 },
48 },
49 {
50 name: "no ID supplied with --yes",
51 cli: "--yes",
52 tty: true,
53 want: DeleteOptions{
54 Selector: "",
55 },
56 },
57 {
58 name: "selector with --yes, no tty",
59 cli: "123 --yes",
60 tty: false,
61 want: DeleteOptions{
62 Selector: "123",
63 },
64 },
65 {
66 name: "ID arg without --yes, no tty",
67 cli: "123",
68 tty: false,
69 want: DeleteOptions{
70 Selector: "",
71 },
72 wantErr: true,
73 wantErrMsg: "--yes required when not running interactively",
74 },
75 {
76 name: "no ID supplied with --yes, no tty",
77 cli: "--yes",
78 tty: false,
79 want: DeleteOptions{
80 Selector: "",
81 },

Callers

nothing calls this directly

Calls 6

TestFunction · 0.92
SetStdinTTYMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
NewCmdDeleteFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected