MCPcopy
hub / github.com/cli/cli / TestNewCmdeditItem

Function TestNewCmdeditItem

pkg/cmd/project/item-edit/item_edit_test.go:14–187  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestNewCmdeditItem(t *testing.T) {
15 tests := []struct {
16 name string
17 cli string
18 wants editItemOpts
19 wantsErr bool
20 wantsErrMsg string
21 wantsExporter bool
22 }{
23 {
24 name: "missing-id",
25 cli: "",
26 wantsErr: true,
27 wantsErrMsg: "required flag(s) \"id\" not set",
28 },
29 {
30 name: "invalid-flags",
31 cli: "--id 123 --text t --date 2023-01-01",
32 wantsErr: true,
33 wantsErrMsg: "only one of `--text`, `--number`, `--date`, `--single-select-option-id` or `--iteration-id` may be used",
34 },
35 {
36 name: "item-id",
37 cli: "--id 123",
38 wants: editItemOpts{
39 itemID: "123",
40 },
41 },
42 {
43 name: "number",
44 cli: "--number 456 --id 123",
45 wants: editItemOpts{
46 number: 456,
47 itemID: "123",
48 },
49 },
50 {
51 name: "number with floating point value",
52 cli: "--number 123.45 --id 123",
53 wants: editItemOpts{
54 number: 123.45,
55 itemID: "123",
56 },
57 },
58 {
59 name: "number zero",
60 cli: "--number 0 --id 123",
61 wants: editItemOpts{
62 number: 0,
63 itemID: "123",
64 },
65 },
66 {
67 name: "field-id",
68 cli: "--field-id FIELD_ID --id 123",
69 wants: editItemOpts{
70 fieldID: "FIELD_ID",
71 itemID: "123",

Callers

nothing calls this directly

Calls 5

TestFunction · 0.92
NewCmdEditItemFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected