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

Function TestPRView_Preview_nontty

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

Source from the content-addressed store, hash-verified

254}
255
256func TestPRView_Preview_nontty(t *testing.T) {
257 tests := map[string]struct {
258 branch string
259 args string
260 fixtures map[string]string
261 expectedOutputs []string
262 }{
263 "Open PR without metadata": {
264 branch: "master",
265 args: "12",
266 fixtures: map[string]string{
267 "PullRequestByNumber": "./fixtures/prViewPreview.json",
268 },
269 expectedOutputs: []string{
270 `title:\tBlueberries are from a fork\n`,
271 `state:\tOPEN\n`,
272 `author:\tnobody\n`,
273 `labels:\t\n`,
274 `assignees:\t\n`,
275 `reviewers:\t\n`,
276 `projects:\t\n`,
277 `milestone:\t\n`,
278 `url:\thttps://github.com/OWNER/REPO/pull/12\n`,
279 `additions:\t100\n`,
280 `deletions:\t10\n`,
281 `number:\t12\n`,
282 `blueberries taste good`,
283 },
284 },
285 "Open PR with metadata by number": {
286 branch: "master",
287 args: "12",
288 fixtures: map[string]string{
289 "PullRequestByNumber": "./fixtures/prViewPreviewWithMetadataByNumber.json",
290 },
291 expectedOutputs: []string{
292 `title:\tBlueberries are from a fork\n`,
293 `reviewers:\t1 \(Requested\)\n`,
294 `assignees:\tmarseilles, monaco\n`,
295 `labels:\tClosed: Duplicate, Closed: Won't Fix, help wanted, Status: In Progress, Type: Bug\n`,
296 `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`,
297 `milestone:\tuluru\n`,
298 `\*\*blueberries taste good\*\*`,
299 },
300 },
301 "Open PR with reviewers by number": {
302 branch: "master",
303 args: "12",
304 fixtures: map[string]string{
305 "PullRequestByNumber": "./fixtures/prViewPreviewWithReviewersByNumber.json",
306 "ReviewsForPullRequest": "./fixtures/prViewPreviewManyReviews.json",
307 },
308 expectedOutputs: []string{
309 `title:\tBlueberries are from a fork\n`,
310 `state:\tOPEN\n`,
311 `author:\tnobody\n`,
312 `labels:\t\n`,
313 `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