MCPcopy
hub / github.com/cli/cli / TestNewCmdList

Function TestNewCmdList

pkg/cmd/agent-task/view/view_test.go:26–158  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestNewCmdList(t *testing.T) {
27 tests := []struct {
28 name string
29 tty bool
30 args string
31 wantOpts ViewOptions
32 wantBaseRepo ghrepo.Interface
33 wantErr string
34 }{
35 {
36 name: "no arg tty",
37 tty: true,
38 args: "",
39 wantOpts: ViewOptions{},
40 },
41 {
42 name: "session ID arg tty",
43 tty: true,
44 args: "00000000-0000-0000-0000-000000000000",
45 wantOpts: ViewOptions{
46 SelectorArg: "00000000-0000-0000-0000-000000000000",
47 SessionID: "00000000-0000-0000-0000-000000000000",
48 },
49 },
50 {
51 name: "PR agent-session URL arg tty",
52 tty: true,
53 args: "https://github.com/OWNER/REPO/pull/101/agent-sessions/00000000-0000-0000-0000-000000000000",
54 wantOpts: ViewOptions{
55 SelectorArg: "https://github.com/OWNER/REPO/pull/101/agent-sessions/00000000-0000-0000-0000-000000000000",
56 SessionID: "00000000-0000-0000-0000-000000000000",
57 },
58 },
59 {
60 name: "non-session ID arg tty",
61 tty: true,
62 args: "some-arg",
63 wantOpts: ViewOptions{
64 SelectorArg: "some-arg",
65 },
66 },
67 {
68 name: "session ID required if non-tty",
69 tty: false,
70 args: "some-arg",
71 wantErr: "session ID is required when not running interactively",
72 },
73 {
74 name: "repo override",
75 tty: true,
76 args: "some-arg -R OWNER/REPO",
77 wantBaseRepo: ghrepo.New("OWNER", "REPO"),
78 wantOpts: ViewOptions{
79 SelectorArg: "some-arg",
80 },
81 },
82 {
83 name: "with --log",

Callers

nothing calls this directly

Calls 12

NewFunction · 0.92
TestFunction · 0.92
IsSameFunction · 0.92
SetStdinTTYMethod · 0.80
SetStdoutTTYMethod · 0.80
SetStderrTTYMethod · 0.80
ContainsMethod · 0.80
EqualMethod · 0.80
NewCmdViewFunction · 0.70
RunMethod · 0.65
BaseRepoMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected