Fix tests for preview messages with a issue/PR state

This commit is contained in:
Toshiya Doi 2020-03-16 03:07:52 +09:00
parent b8edb9f62d
commit e0bfd67c69
5 changed files with 14 additions and 5 deletions

View file

@ -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 {

View file

@ -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 {

View file

@ -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",

View file

@ -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": {

View file

@ -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",