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

Function TestPullRequest_ExportData

api/export_pr_test.go:428–681  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

426}
427
428func TestPullRequest_ExportData(t *testing.T) {
429 tests := []struct {
430 name string
431 fields []string
432 inputJSON string
433 outputJSON string
434 }{
435 {
436 name: "simple",
437 fields: []string{"number", "title"},
438 inputJSON: heredoc.Doc(`
439 { "title": "Bugs hugs", "number": 2345 }
440 `),
441 outputJSON: heredoc.Doc(`
442 {
443 "number": 2345,
444 "title": "Bugs hugs"
445 }
446 `),
447 },
448 {
449 name: "milestone",
450 fields: []string{"number", "milestone"},
451 inputJSON: heredoc.Doc(`
452 { "number": 2345, "milestone": {"title": "The next big thing"} }
453 `),
454 outputJSON: heredoc.Doc(`
455 {
456 "milestone": {
457 "number": 0,
458 "title": "The next big thing",
459 "description": "",
460 "dueOn": null
461 },
462 "number": 2345
463 }
464 `),
465 },
466 {
467 // The upload path needs a numeric id and a viewer permission,
468 // which this selection cannot provide. Sharing one Go type with
469 // that path once put both keys here, always zero. This row fails
470 // if that happens again.
471 name: "head repository",
472 fields: []string{"headRepository"},
473 inputJSON: heredoc.Doc(`
474 { "headRepository": {"id": "R_kgDOAAA", "name": "REPO", "nameWithOwner": "OWNER/REPO"} }
475 `),
476 outputJSON: heredoc.Doc(`
477 {
478 "headRepository": {
479 "id": "R_kgDOAAA",
480 "name": "REPO",
481 "nameWithOwner": "OWNER/REPO"
482 }
483 }
484 `),
485 },

Callers

nothing calls this directly

Calls 3

ExportDataMethod · 0.95
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected