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

Function TestPRView_Preview_nontty

pkg/cmd/pr/view/view_test.go:249–424  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

247}
248
249func TestPRView_Preview_nontty(t *testing.T) {
250 tests := map[string]struct {
251 branch string
252 args string
253 fixtures map[string]string
254 expectedOutputs []string
255 }{
256 "Open PR without metadata": {
257 branch: "master",
258 args: "12",
259 fixtures: map[string]string{
260 "PullRequestByNumber": "./fixtures/prViewPreview.json",
261 },
262 expectedOutputs: []string{
263 `title:\tBlueberries are from a fork\n`,
264 `state:\tOPEN\n`,
265 `author:\tnobody\n`,
266 `labels:\t\n`,
267 `assignees:\t\n`,
268 `reviewers:\t\n`,
269 `projects:\t\n`,
270 `milestone:\t\n`,
271 `url:\thttps://github.com/OWNER/REPO/pull/12\n`,
272 `additions:\t100\n`,
273 `deletions:\t10\n`,
274 `number:\t12\n`,
275 `blueberries taste good`,
276 },
277 },
278 "Open PR with metadata by number": {
279 branch: "master",
280 args: "12",
281 fixtures: map[string]string{
282 "PullRequestByNumber": "./fixtures/prViewPreviewWithMetadataByNumber.json",
283 },
284 expectedOutputs: []string{
285 `title:\tBlueberries are from a fork\n`,
286 `reviewers:\t1 \(Requested\)\n`,
287 `assignees:\tmarseilles, monaco\n`,
288 `labels:\tClosed: Duplicate, Closed: Won't Fix, help wanted, Status: In Progress, Type: Bug\n`,
289 `projects:\tv2 Project 1 \(No Status\), v2 Project 2 \(Done\), Project 1 \(column A\), Project 2 \(column B\), Project 3 \(column C\), Project 4 \(Awaiting triage\)\n`,
290 `milestone:\tuluru\n`,
291 `\*\*blueberries taste good\*\*`,
292 },
293 },
294 "Open PR with reviewers by number": {
295 branch: "master",
296 args: "12",
297 fixtures: map[string]string{
298 "PullRequestByNumber": "./fixtures/prViewPreviewWithReviewersByNumber.json",
299 "ReviewsForPullRequest": "./fixtures/prViewPreviewManyReviews.json",
300 },
301 expectedOutputs: []string{
302 `title:\tBlueberries are from a fork\n`,
303 `state:\tOPEN\n`,
304 `author:\tnobody\n`,
305 `labels:\t\n`,
306 `assignees:\t\n`,

Callers

nothing calls this directly

Calls 11

VerifyMethod · 0.95
NewFunction · 0.92
ExpectLinesFunction · 0.92
prFromFixturesFunction · 0.85
EqualMethod · 0.80
StderrMethod · 0.80
runCommandFunction · 0.70
RunMethod · 0.65
ErrorfMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected