add tests for additions and deletions
This commit is contained in:
parent
f2489ed22f
commit
1d8dd2f1e9
13 changed files with 59 additions and 11 deletions
|
|
@ -14,6 +14,8 @@
|
|||
"headRepositoryOwner": {
|
||||
"login": "hubot"
|
||||
},
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"commits": {
|
||||
"totalCount": 12
|
||||
},
|
||||
|
|
@ -34,6 +36,8 @@
|
|||
"author": {
|
||||
"login": "nobody"
|
||||
},
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"headRepositoryOwner": {
|
||||
"login": "OWNER"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
"author": {
|
||||
"login": "nobody"
|
||||
},
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"assignees": {
|
||||
"nodes": [],
|
||||
"totalcount": 0
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
"author": {
|
||||
"login": "nobody"
|
||||
},
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"commits": {
|
||||
"totalCount": 12
|
||||
},
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
"commits": {
|
||||
"totalCount": 12
|
||||
},
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"baseRefName": "master",
|
||||
"headRefName": "blueberries",
|
||||
"headRepositoryOwner": {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
"headRepositoryOwner": {
|
||||
"login": "hubot"
|
||||
},
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"commits": {
|
||||
"totalCount": 12
|
||||
},
|
||||
|
|
@ -37,6 +39,8 @@
|
|||
"headRepositoryOwner": {
|
||||
"login": "OWNER"
|
||||
},
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"commits": {
|
||||
"totalCount": 8
|
||||
},
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
"commits": {
|
||||
"totalCount": 12
|
||||
},
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"baseRefName": "master",
|
||||
"headRefName": "blueberries",
|
||||
"headRepositoryOwner": {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
"author": {
|
||||
"login": "nobody"
|
||||
},
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"assignees": {
|
||||
"nodes": [],
|
||||
"totalcount": 0
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
"url": "https://github.com/OWNER/REPO/pull/12",
|
||||
"headRefName": "blueberries",
|
||||
"baseRefName": "master",
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"headRepositoryOwner": {
|
||||
"login": "hubot"
|
||||
},
|
||||
|
|
@ -49,6 +51,8 @@
|
|||
"author": {
|
||||
"login": "nobody"
|
||||
},
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"assignees": {
|
||||
"nodes": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
"author": {
|
||||
"login": "nobody"
|
||||
},
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"reviewRequests": {
|
||||
"nodes": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
"author": {
|
||||
"login": "nobody"
|
||||
},
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"reviewRequests": {
|
||||
"nodes": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
"headRepositoryOwner": {
|
||||
"login": "hubot"
|
||||
},
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"commits": {
|
||||
"totalCount": 12
|
||||
},
|
||||
|
|
@ -30,6 +32,8 @@
|
|||
"url": "https://github.com/OWNER/REPO/pull/10",
|
||||
"baseRefName": "master",
|
||||
"headRefName": "blueberries",
|
||||
"additions": 100,
|
||||
"deletions": 10,
|
||||
"author": {
|
||||
"login": "nobody"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -138,8 +138,8 @@ func printRawPrPreview(io *iostreams.IOStreams, pr *api.PullRequest) error {
|
|||
fmt.Fprintf(out, "milestone:\t%s\n", pr.Milestone.Title)
|
||||
fmt.Fprintf(out, "number:\t%d\n", pr.Number)
|
||||
fmt.Fprintf(out, "url:\t%s\n", pr.URL)
|
||||
fmt.Fprintf(out, "additions:\t+%s\n", cs.Green(strconv.Itoa(pr.Additions)))
|
||||
fmt.Fprintf(out, "deletions:\t-%s\n", cs.Red(strconv.Itoa(pr.Deletions)))
|
||||
fmt.Fprintf(out, "additions:\t%s\n", cs.Green(strconv.Itoa(pr.Additions)))
|
||||
fmt.Fprintf(out, "deletions:\t%s\n", cs.Red(strconv.Itoa(pr.Deletions)))
|
||||
|
||||
fmt.Fprintln(out, "--")
|
||||
fmt.Fprintln(out, pr.Body)
|
||||
|
|
|
|||
|
|
@ -185,6 +185,8 @@ func TestPRView_Preview_nontty(t *testing.T) {
|
|||
`projects:\t\n`,
|
||||
`milestone:\t\n`,
|
||||
`url:\thttps://github.com/OWNER/REPO/pull/12\n`,
|
||||
`additions:\t100\n`,
|
||||
`deletions:\t10\n`,
|
||||
`number:\t12\n`,
|
||||
`blueberries taste good`,
|
||||
},
|
||||
|
|
@ -221,6 +223,8 @@ func TestPRView_Preview_nontty(t *testing.T) {
|
|||
`assignees:\t\n`,
|
||||
`projects:\t\n`,
|
||||
`milestone:\t\n`,
|
||||
`additions:\t100\n`,
|
||||
`deletions:\t10\n`,
|
||||
`reviewers:\tDEF \(Commented\), def \(Changes requested\), ghost \(Approved\), hubot \(Commented\), xyz \(Approved\), 123 \(Requested\), Team 1 \(Requested\), abc \(Requested\)\n`,
|
||||
`\*\*blueberries taste good\*\*`,
|
||||
},
|
||||
|
|
@ -241,6 +245,8 @@ func TestPRView_Preview_nontty(t *testing.T) {
|
|||
`labels:\tone, two, three, four, five\n`,
|
||||
`projects:\tProject 1 \(column A\), Project 2 \(column B\), Project 3 \(column C\)\n`,
|
||||
`milestone:\tuluru\n`,
|
||||
`additions:\t100\n`,
|
||||
`deletions:\t10\n`,
|
||||
`blueberries taste good`,
|
||||
},
|
||||
},
|
||||
|
|
@ -260,6 +266,8 @@ func TestPRView_Preview_nontty(t *testing.T) {
|
|||
`labels:\t\n`,
|
||||
`projects:\t\n`,
|
||||
`milestone:\t\n`,
|
||||
`additions:\t100\n`,
|
||||
`deletions:\t10\n`,
|
||||
`\*\*blueberries taste good\*\*`,
|
||||
},
|
||||
},
|
||||
|
|
@ -279,6 +287,8 @@ func TestPRView_Preview_nontty(t *testing.T) {
|
|||
`labels:\t\n`,
|
||||
`projects:\t\n`,
|
||||
`milestone:\t\n`,
|
||||
`additions:\t100\n`,
|
||||
`deletions:\t10\n`,
|
||||
},
|
||||
},
|
||||
"Closed PR": {
|
||||
|
|
@ -296,6 +306,8 @@ func TestPRView_Preview_nontty(t *testing.T) {
|
|||
`reviewers:\t\n`,
|
||||
`projects:\t\n`,
|
||||
`milestone:\t\n`,
|
||||
`additions:\t100\n`,
|
||||
`deletions:\t10\n`,
|
||||
`\*\*blueberries taste good\*\*`,
|
||||
},
|
||||
},
|
||||
|
|
@ -314,6 +326,8 @@ func TestPRView_Preview_nontty(t *testing.T) {
|
|||
`reviewers:\t\n`,
|
||||
`projects:\t\n`,
|
||||
`milestone:\t\n`,
|
||||
`additions:\t100\n`,
|
||||
`deletions:\t10\n`,
|
||||
`\*\*blueberries taste good\*\*`,
|
||||
},
|
||||
},
|
||||
|
|
@ -333,6 +347,8 @@ func TestPRView_Preview_nontty(t *testing.T) {
|
|||
`reviewers:`,
|
||||
`projects:`,
|
||||
`milestone:`,
|
||||
`additions:\t100\n`,
|
||||
`deletions:\t10\n`,
|
||||
`\*\*blueberries taste good\*\*`,
|
||||
},
|
||||
},
|
||||
|
|
@ -352,6 +368,8 @@ func TestPRView_Preview_nontty(t *testing.T) {
|
|||
`reviewers:`,
|
||||
`projects:`,
|
||||
`milestone:`,
|
||||
`additions:\t100\n`,
|
||||
`deletions:\t10\n`,
|
||||
`\*\*blueberries taste good\*\*`,
|
||||
},
|
||||
},
|
||||
|
|
@ -395,7 +413,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are from a fork`,
|
||||
`Open.*nobody wants to merge 12 commits into master from blueberries`,
|
||||
`Open.*nobody wants to merge 12 commits into master from blueberries.+100.-10`,
|
||||
`blueberries taste good`,
|
||||
`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`,
|
||||
},
|
||||
|
|
@ -409,7 +427,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are from a fork`,
|
||||
`Open.*nobody wants to merge 12 commits into master from blueberries`,
|
||||
`Open.*nobody wants to merge 12 commits into master from blueberries.+100.-10`,
|
||||
`Reviewers:.*1 \(.*Requested.*\)\n`,
|
||||
`Assignees:.*marseilles, monaco\n`,
|
||||
`Labels:.*one, two, three, four, five\n`,
|
||||
|
|
@ -442,7 +460,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are a good fruit`,
|
||||
`Open.*nobody wants to merge 8 commits into master from blueberries`,
|
||||
`Open.*nobody wants to merge 8 commits into master from blueberries.+100.-10`,
|
||||
`Assignees:.*marseilles, monaco\n`,
|
||||
`Labels:.*one, two, three, four, five\n`,
|
||||
`Projects:.*Project 1 \(column A\), Project 2 \(column B\), Project 3 \(column C\)\n`,
|
||||
|
|
@ -460,7 +478,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are a good fruit`,
|
||||
`Open.*nobody wants to merge 8 commits into master from blueberries`,
|
||||
`Open.*nobody wants to merge 8 commits into master from blueberries.+100.-10`,
|
||||
`blueberries taste good`,
|
||||
`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10`,
|
||||
},
|
||||
|
|
@ -474,7 +492,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are a good fruit`,
|
||||
`Open.*nobody wants to merge 8 commits into master from blueberries`,
|
||||
`Open.*nobody wants to merge 8 commits into master from blueberries.+100.-10`,
|
||||
`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10`,
|
||||
},
|
||||
},
|
||||
|
|
@ -487,7 +505,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are from a fork`,
|
||||
`Closed.*nobody wants to merge 12 commits into master from blueberries`,
|
||||
`Closed.*nobody wants to merge 12 commits into master from blueberries.+100.-10`,
|
||||
`blueberries taste good`,
|
||||
`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`,
|
||||
},
|
||||
|
|
@ -501,7 +519,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are from a fork`,
|
||||
`Merged.*nobody wants to merge 12 commits into master from blueberries`,
|
||||
`Merged.*nobody wants to merge 12 commits into master from blueberries.+100.-10`,
|
||||
`blueberries taste good`,
|
||||
`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`,
|
||||
},
|
||||
|
|
@ -515,7 +533,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are from a fork`,
|
||||
`Draft.*nobody wants to merge 12 commits into master from blueberries`,
|
||||
`Draft.*nobody wants to merge 12 commits into master from blueberries.+100.-10`,
|
||||
`blueberries taste good`,
|
||||
`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`,
|
||||
},
|
||||
|
|
@ -529,7 +547,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are a good fruit`,
|
||||
`Draft.*nobody wants to merge 8 commits into master from blueberries`,
|
||||
`Draft.*nobody wants to merge 8 commits into master from blueberries.+100.-10`,
|
||||
`blueberries taste good`,
|
||||
`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10`,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue