MCPcopy
hub / github.com/cli/cli / TestStatusRun

Function TestStatusRun

pkg/cmd/status/status_test.go:87–463  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

85}
86
87func TestStatusRun(t *testing.T) {
88 tests := []struct {
89 name string
90 httpStubs func(*httpmock.Registry)
91 opts *StatusOptions
92 wantOut string
93 wantErrMsg string
94 }{
95 {
96 name: "nothing",
97 httpStubs: func(reg *httpmock.Registry) {
98 reg.Register(
99 httpmock.GraphQL("UserCurrent"),
100 httpmock.StringResponse(`{"data": {"viewer": {"login": "jillvalentine"}}}`))
101 reg.Register(
102 httpmock.GraphQL("AssignedSearch"),
103 httpmock.StringResponse(`{"data": { "assignments": {"nodes": [] }, "reviewRequested": {"nodes": []}}}`))
104 reg.Register(
105 httpmock.REST("GET", "notifications"),
106 httpmock.StringResponse(`[]`))
107 reg.Register(
108 httpmock.REST("GET", "users/jillvalentine/received_events"),
109 httpmock.StringResponse(`[]`))
110 },
111 opts: &StatusOptions{},
112 wantOut: "Assigned Issues │ Assigned Pull Requests \nNothing here ^_^ │ Nothing here ^_^ \n │ \nReview Requests │ Mentions \nNothing here ^_^ │ Nothing here ^_^ \n │ \nRepository Activity\nNothing here ^_^\n\n",
113 },
114 {
115 name: "something",
116 httpStubs: func(reg *httpmock.Registry) {
117 reg.Register(
118 httpmock.GraphQL("UserCurrent"),
119 httpmock.StringResponse(`{"data": {"viewer": {"login": "jillvalentine"}}}`))
120 reg.Register(
121 httpmock.REST("GET", "repos/rpd/todo/issues/110"),
122 httpmock.StringResponse(`{"body":"hello @jillvalentine how are you"}`))
123 reg.Register(
124 httpmock.REST("GET", "repos/rpd/todo/issues/4113"),
125 httpmock.StringResponse(`{"body":"this is a comment"}`))
126 reg.Register(
127 httpmock.REST("GET", "repos/cli/cli/issues/1096"),
128 httpmock.StringResponse(`{"body":"@jillvalentine hi"}`))
129 reg.Register(
130 httpmock.REST("GET", "repos/rpd/todo/issues/comments/1065"),
131 httpmock.StringResponse(`{"body":"not a real mention"}`))
132 reg.Register(
133 httpmock.REST("GET", "repos/vilmibm/gh-screensaver/issues/comments/10"),
134 httpmock.StringResponse(`{"body":"a message for @jillvalentine"}`))
135 reg.Register(
136 httpmock.GraphQL("AssignedSearch"),
137 httpmock.FileResponse("./fixtures/search.json"))
138 reg.Register(
139 httpmock.REST("GET", "notifications"),
140 httpmock.FileResponse("./fixtures/notifications.json"))
141 reg.Register(
142 httpmock.REST("GET", "users/jillvalentine/received_events"),
143 httpmock.FileResponse("./fixtures/events.json"))
144 },

Callers

nothing calls this directly

Calls 15

RegisterMethod · 0.95
VerifyMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
RESTFunction · 0.92
FileResponseFunction · 0.92
StatusStringResponseFunction · 0.92
TestFunction · 0.92
testHostConfigTypeAlias · 0.85
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
statusRunFunction · 0.70

Tested by

no test coverage detected