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

Function TestNewCmdView

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

Source from the content-addressed store, hash-verified

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