From e0bfd67c69a084b8dbd513ae665dcf24324d4237 Mon Sep 17 00:00:00 2001 From: Toshiya Doi Date: Mon, 16 Mar 2020 03:07:52 +0900 Subject: [PATCH] Fix tests for preview messages with a issue/PR state --- command/issue_test.go | 8 ++++++-- command/pr_test.go | 6 +++--- test/fixtures/prView.json | 2 ++ test/fixtures/prViewPreview.json | 1 + test/fixtures/prView_EmptyBody.json | 2 ++ 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/command/issue_test.go b/command/issue_test.go index a4de959e1..e11826bfc 100644 --- a/command/issue_test.go +++ b/command/issue_test.go @@ -289,6 +289,8 @@ func TestIssueView_preview(t *testing.T) { "number": 123, "body": "**bold story**", "title": "ix of coins", + "state": "OPEN", + "created_at": "2011-01-26T19:01:12Z", "author": { "login": "marseilles" }, @@ -313,7 +315,7 @@ func TestIssueView_preview(t *testing.T) { expectedLines := []*regexp.Regexp{ regexp.MustCompile(`ix of coins`), - regexp.MustCompile(`opened by marseilles. 9 comments. \(tarot\)`), + regexp.MustCompile(`OPEN • marseilles opened about 292 years ago • 9 comments • tarot`), regexp.MustCompile(`bold story`), regexp.MustCompile(`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`), } @@ -335,6 +337,8 @@ func TestIssueView_previewWithEmptyBody(t *testing.T) { "number": 123, "body": "", "title": "ix of coins", + "state": "OPEN", + "created_at": "2011-01-26T19:01:12Z", "author": { "login": "marseilles" }, @@ -359,7 +363,7 @@ func TestIssueView_previewWithEmptyBody(t *testing.T) { expectedLines := []*regexp.Regexp{ regexp.MustCompile(`ix of coins`), - regexp.MustCompile(`opened by marseilles. 9 comments. \(tarot\)`), + regexp.MustCompile(`OPEN • marseilles opened about 292 years ago • 9 comments • tarot`), regexp.MustCompile(`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`), } for _, r := range expectedLines { diff --git a/command/pr_test.go b/command/pr_test.go index f024792e3..f3884b46a 100644 --- a/command/pr_test.go +++ b/command/pr_test.go @@ -399,7 +399,7 @@ func TestPRView_preview(t *testing.T) { expectedLines := []*regexp.Regexp{ regexp.MustCompile(`Blueberries are from a fork`), - regexp.MustCompile(`nobody wants to merge 12 commits into master from blueberries`), + regexp.MustCompile(`OPEN • nobody wants to merge 12 commits into master from blueberries`), regexp.MustCompile(`blueberries taste good`), regexp.MustCompile(`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`), } @@ -434,7 +434,7 @@ func TestPRView_previewCurrentBranch(t *testing.T) { expectedLines := []*regexp.Regexp{ regexp.MustCompile(`Blueberries are a good fruit`), - regexp.MustCompile(`nobody wants to merge 8 commits into master from blueberries`), + regexp.MustCompile(`OPEN • nobody wants to merge 8 commits into master from blueberries`), regexp.MustCompile(`blueberries taste good`), regexp.MustCompile(`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10`), } @@ -469,7 +469,7 @@ func TestPRView_previewCurrentBranchWithEmptyBody(t *testing.T) { expectedLines := []*regexp.Regexp{ regexp.MustCompile(`Blueberries are a good fruit`), - regexp.MustCompile(`nobody wants to merge 8 commits into master from blueberries`), + regexp.MustCompile(`OPEN • nobody wants to merge 8 commits into master from blueberries`), regexp.MustCompile(`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10`), } for _, r := range expectedLines { diff --git a/test/fixtures/prView.json b/test/fixtures/prView.json index 02277d7a5..2b6b4f9b5 100644 --- a/test/fixtures/prView.json +++ b/test/fixtures/prView.json @@ -6,6 +6,7 @@ { "number": 12, "title": "Blueberries are from a fork", + "state": "OPEN", "body": "yeah", "url": "https://github.com/OWNER/REPO/pull/12", "headRefName": "blueberries", @@ -24,6 +25,7 @@ { "number": 10, "title": "Blueberries are a good fruit", + "state": "OPEN", "body": "**blueberries taste good**", "url": "https://github.com/OWNER/REPO/pull/10", "baseRefName": "master", diff --git a/test/fixtures/prViewPreview.json b/test/fixtures/prViewPreview.json index e40946774..2b551a18f 100644 --- a/test/fixtures/prViewPreview.json +++ b/test/fixtures/prViewPreview.json @@ -4,6 +4,7 @@ "pullRequest": { "number": 12, "title": "Blueberries are from a fork", + "state": "OPEN", "body": "**blueberries taste good**", "url": "https://github.com/OWNER/REPO/pull/12", "author": { diff --git a/test/fixtures/prView_EmptyBody.json b/test/fixtures/prView_EmptyBody.json index 651f49ce0..36fdc308b 100644 --- a/test/fixtures/prView_EmptyBody.json +++ b/test/fixtures/prView_EmptyBody.json @@ -6,6 +6,7 @@ { "number": 12, "title": "Blueberries are from a fork", + "state": "OPEN", "body": "yeah", "url": "https://github.com/OWNER/REPO/pull/12", "headRefName": "blueberries", @@ -24,6 +25,7 @@ { "number": 10, "title": "Blueberries are a good fruit", + "state": "OPEN", "body": "", "url": "https://github.com/OWNER/REPO/pull/10", "baseRefName": "master",