Skip to content

Commit e0bfd67

Browse files
committed
Fix tests for preview messages with a issue/PR state
1 parent b8edb9f commit e0bfd67

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

command/issue_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ func TestIssueView_preview(t *testing.T) {
289289
"number": 123,
290290
"body": "**bold story**",
291291
"title": "ix of coins",
292+
"state": "OPEN",
293+
"created_at": "2011-01-26T19:01:12Z",
292294
"author": {
293295
"login": "marseilles"
294296
},
@@ -313,7 +315,7 @@ func TestIssueView_preview(t *testing.T) {
313315

314316
expectedLines := []*regexp.Regexp{
315317
regexp.MustCompile(`ix of coins`),
316-
regexp.MustCompile(`opened by marseilles. 9 comments. \(tarot\)`),
318+
regexp.MustCompile(`OPEN • marseilles opened about 292 years ago • 9 commentstarot`),
317319
regexp.MustCompile(`bold story`),
318320
regexp.MustCompile(`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`),
319321
}
@@ -335,6 +337,8 @@ func TestIssueView_previewWithEmptyBody(t *testing.T) {
335337
"number": 123,
336338
"body": "",
337339
"title": "ix of coins",
340+
"state": "OPEN",
341+
"created_at": "2011-01-26T19:01:12Z",
338342
"author": {
339343
"login": "marseilles"
340344
},
@@ -359,7 +363,7 @@ func TestIssueView_previewWithEmptyBody(t *testing.T) {
359363

360364
expectedLines := []*regexp.Regexp{
361365
regexp.MustCompile(`ix of coins`),
362-
regexp.MustCompile(`opened by marseilles. 9 comments. \(tarot\)`),
366+
regexp.MustCompile(`OPEN • marseilles opened about 292 years ago • 9 commentstarot`),
363367
regexp.MustCompile(`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`),
364368
}
365369
for _, r := range expectedLines {

command/pr_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ func TestPRView_preview(t *testing.T) {
399399

400400
expectedLines := []*regexp.Regexp{
401401
regexp.MustCompile(`Blueberries are from a fork`),
402-
regexp.MustCompile(`nobody wants to merge 12 commits into master from blueberries`),
402+
regexp.MustCompile(`OPEN • nobody wants to merge 12 commits into master from blueberries`),
403403
regexp.MustCompile(`blueberries taste good`),
404404
regexp.MustCompile(`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`),
405405
}
@@ -434,7 +434,7 @@ func TestPRView_previewCurrentBranch(t *testing.T) {
434434

435435
expectedLines := []*regexp.Regexp{
436436
regexp.MustCompile(`Blueberries are a good fruit`),
437-
regexp.MustCompile(`nobody wants to merge 8 commits into master from blueberries`),
437+
regexp.MustCompile(`OPEN • nobody wants to merge 8 commits into master from blueberries`),
438438
regexp.MustCompile(`blueberries taste good`),
439439
regexp.MustCompile(`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10`),
440440
}
@@ -469,7 +469,7 @@ func TestPRView_previewCurrentBranchWithEmptyBody(t *testing.T) {
469469

470470
expectedLines := []*regexp.Regexp{
471471
regexp.MustCompile(`Blueberries are a good fruit`),
472-
regexp.MustCompile(`nobody wants to merge 8 commits into master from blueberries`),
472+
regexp.MustCompile(`OPEN • nobody wants to merge 8 commits into master from blueberries`),
473473
regexp.MustCompile(`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10`),
474474
}
475475
for _, r := range expectedLines {

test/fixtures/prView.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
{
77
"number": 12,
88
"title": "Blueberries are from a fork",
9+
"state": "OPEN",
910
"body": "yeah",
1011
"url": "https://github.com/OWNER/REPO/pull/12",
1112
"headRefName": "blueberries",
@@ -24,6 +25,7 @@
2425
{
2526
"number": 10,
2627
"title": "Blueberries are a good fruit",
28+
"state": "OPEN",
2729
"body": "**blueberries taste good**",
2830
"url": "https://github.com/OWNER/REPO/pull/10",
2931
"baseRefName": "master",

test/fixtures/prViewPreview.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"pullRequest": {
55
"number": 12,
66
"title": "Blueberries are from a fork",
7+
"state": "OPEN",
78
"body": "**blueberries taste good**",
89
"url": "https://github.com/OWNER/REPO/pull/12",
910
"author": {

test/fixtures/prView_EmptyBody.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
{
77
"number": 12,
88
"title": "Blueberries are from a fork",
9+
"state": "OPEN",
910
"body": "yeah",
1011
"url": "https://github.com/OWNER/REPO/pull/12",
1112
"headRefName": "blueberries",
@@ -24,6 +25,7 @@
2425
{
2526
"number": 10,
2627
"title": "Blueberries are a good fruit",
28+
"state": "OPEN",
2729
"body": "",
2830
"url": "https://github.com/OWNER/REPO/pull/10",
2931
"baseRefName": "master",

0 commit comments

Comments
 (0)