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

Function TestPRView_Preview_nontty

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

Source from the content-addressed store, hash-verified

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