MCPcopy Create free account
hub / github.com/cli/cli / TestNewCmdView

Function TestNewCmdView

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

TestFunction · 0.92
NewMockConfigFunction · 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