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

Function TestNewCmdView

pkg/cmd/issue/view/view_test.go:60–75  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func TestNewCmdView(t *testing.T) {
61 // Test shared parsing of issue number / URL.
62 argparsetest.TestArgParsing(t, NewCmdView)
63
64 t.Run("comments and JSON are mutually exclusive", func(t *testing.T) {
65 cmd := NewCmdView(&cmdutil.Factory{}, func(*ViewOptions) error {
66 return nil
67 })
68 cmd.SetArgs([]string{"123", "--comments", "--json", "number"})
69 cmd.SetOut(io.Discard)
70 cmd.SetErr(io.Discard)
71
72 _, err := cmd.ExecuteC()
73 require.EqualError(t, err, "specify only one of --comments or --json")
74 })
75}
76
77func runCommand(rt http.RoundTripper, isTTY bool, cli string) (*test.CmdOut, error) {
78 ios, _, stdout, stderr := iostreams.Test()

Callers

nothing calls this directly

Calls 3

TestArgParsingFunction · 0.92
NewCmdViewFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected