MCPcopy
hub / github.com/cli/cli / TestNewCmdEdit

Function TestNewCmdEdit

pkg/cmd/project/edit/edit_test.go:14–131  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestNewCmdEdit(t *testing.T) {
15 tests := []struct {
16 name string
17 cli string
18 wants editOpts
19 wantsErr bool
20 wantsErrMsg string
21 wantsExporter bool
22 }{
23 {
24 name: "not-a-number",
25 cli: "x",
26 wantsErr: true,
27 wantsErrMsg: "invalid number: x",
28 },
29 {
30 name: "visibility-error",
31 cli: "--visibility v",
32 wantsErr: true,
33 wantsErrMsg: "invalid argument \"v\" for \"--visibility\" flag: valid values are {PUBLIC|PRIVATE}",
34 },
35 {
36 name: "no-args",
37 cli: "",
38 wantsErr: true,
39 wantsErrMsg: "no fields to edit",
40 },
41 {
42 name: "title",
43 cli: "--title t",
44 wants: editOpts{
45 title: "t",
46 },
47 },
48 {
49 name: "number",
50 cli: "123 --title t",
51 wants: editOpts{
52 number: 123,
53 title: "t",
54 },
55 },
56 {
57 name: "owner",
58 cli: "--owner monalisa --title t",
59 wants: editOpts{
60 owner: "monalisa",
61 title: "t",
62 },
63 },
64 {
65 name: "readme",
66 cli: "--readme r",
67 wants: editOpts{
68 readme: "r",
69 },
70 },
71 {

Callers

nothing calls this directly

Calls 5

TestFunction · 0.92
EqualMethod · 0.80
NewCmdEditFunction · 0.70
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected