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

Function TestNewCmdView

pkg/cmd/run/view/view_test.go:30–176  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestNewCmdView(t *testing.T) {
31 tests := []struct {
32 name string
33 cli string
34 tty bool
35 wants ViewOptions
36 wantsErr bool
37 }{
38 {
39 name: "blank nontty",
40 wantsErr: true,
41 },
42 {
43 name: "blank tty",
44 tty: true,
45 wants: ViewOptions{
46 Prompt: true,
47 },
48 },
49 {
50 name: "web tty",
51 tty: true,
52 cli: "--web",
53 wants: ViewOptions{
54 Prompt: true,
55 Web: true,
56 },
57 },
58 {
59 name: "web nontty",
60 cli: "1234 --web",
61 wants: ViewOptions{
62 Web: true,
63 RunID: "1234",
64 },
65 },
66 {
67 name: "disallow web and log",
68 tty: true,
69 cli: "-w --log",
70 wantsErr: true,
71 },
72 {
73 name: "disallow log and log-failed",
74 tty: true,
75 cli: "--log --log-failed",
76 wantsErr: true,
77 },
78 {
79 name: "exit status",
80 cli: "--exit-status 1234",
81 wants: ViewOptions{
82 RunID: "1234",
83 ExitStatus: true,
84 },
85 },
86 {
87 name: "verbosity",

Callers

nothing calls this directly

Calls 8

TestFunction · 0.92
NewBlankConfigFunction · 0.92
SetStdinTTYMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
NewCmdViewFunction · 0.70
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected