Skip to content

Commit

Permalink
test: verify unknown merge error behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Feb 11, 2021
1 parent ce66446 commit 1b68ad3
Show file tree
Hide file tree
Showing 8 changed files with 294 additions and 0 deletions.
56 changes: 56 additions & 0 deletions test/fixtures/merge_error/004_status.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "status",
"type": "event",
"payload": {
"sha": "53e4600f2c01d18a8005f0f3e857c701fed8a9e0",
"name": "nikku/testtest",
"context": "continuous-integration/travis-ci/push",
"state": "success",
"commit": {
"sha": "53e4600f2c01d18a8005f0f3e857c701fed8a9e0",
"commit": {
"author": {
"name": "Nico Rehwaldt"
},
"committer": {
"name": "GitHub"
},
"message": "Update test.txt",
"tree": {
"sha": "911f57504612def9e96f0991fc84d59e078ec674"
},
"comment_count": 0
},
"author": {
"login": "nikku",
"type": "User"
},
"committer": {
"login": "web-flow",
"type": "User"
},
"parents": [
{
"sha": "c5de67566cca3f699aab82e92dc930d964587f2a"
}
]
},
"branches": [
{
"name": "nikku-patch-1",
"commit": {
"sha": "53e4600f2c01d18a8005f0f3e857c701fed8a9e0"
}
}
],
"repository": {
"name": "testtest",
"full_name": "nikku/testtest",
"owner": {
"login": "nikku",
"type": "User"
},
"default_branch": "master"
}
}
}
65 changes: 65 additions & 0 deletions test/fixtures/merge_error/005_pulls.list.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "pulls.list",
"type": "api-call",
"args": {
"owner": "nikku",
"repo": "testtest",
"state": "open",
"head": "nikku:nikku-patch-1"
},
"result": {
"data": [
{
"number": 29,
"state": "open",
"title": "Update test.txt",
"user": {
"login": "nikku",
"type": "User"
},
"merge_commit_sha": "2c249293b68269d009b489c978653101d055301e",
"assignees": [],
"requested_reviewers": [],
"requested_teams": [],
"labels": [],
"head": {
"label": "nikku:nikku-patch-1",
"ref": "nikku-patch-1",
"sha": "53e4600f2c01d18a8005f0f3e857c701fed8a9e0",
"user": {
"login": "nikku",
"type": "User"
},
"repo": {
"name": "testtest",
"full_name": "nikku/testtest",
"owner": {
"login": "nikku",
"type": "User"
},
"default_branch": "master"
}
},
"base": {
"label": "nikku:master",
"ref": "master",
"sha": "c5de67566cca3f699aab82e92dc930d964587f2a",
"user": {
"login": "nikku",
"type": "User"
},
"repo": {
"name": "testtest",
"full_name": "nikku/testtest",
"owner": {
"login": "nikku",
"type": "User"
},
"default_branch": "master"
}
},
"author_association": "OWNER"
}
]
}
}
66 changes: 66 additions & 0 deletions test/fixtures/merge_error/005a_pulls.get.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "pulls.get",
"type": "api-call",
"args": {
"owner": "nikku",
"repo": "testtest",
"pull_number": 29
},
"result": {
"data": {
"rebaseable": true,
"mergeable": true,
"merged": false,
"draft": false,
"number": 29,
"state": "open",
"title": "Update test.txt",
"user": {
"login": "nikku",
"type": "User"
},
"merge_commit_sha": "2c249293b68269d009b489c978653101d055301e",
"assignees": [],
"requested_reviewers": [],
"requested_teams": [],
"labels": [],
"head": {
"label": "nikku:nikku-patch-1",
"ref": "nikku-patch-1",
"sha": "53e4600f2c01d18a8005f0f3e857c701fed8a9e0",
"user": {
"login": "nikku",
"type": "User"
},
"repo": {
"name": "testtest",
"full_name": "nikku/testtest",
"owner": {
"login": "nikku",
"type": "User"
},
"default_branch": "master"
}
},
"base": {
"label": "nikku:master",
"ref": "master",
"sha": "c5de67566cca3f699aab82e92dc930d964587f2a",
"user": {
"login": "nikku",
"type": "User"
},
"repo": {
"name": "testtest",
"full_name": "nikku/testtest",
"owner": {
"login": "nikku",
"type": "User"
},
"default_branch": "master"
}
},
"author_association": "OWNER"
}
}
}
12 changes: 12 additions & 0 deletions test/fixtures/merge_error/005b_config.get.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "config.get",
"type": "api-call",
"args": {
"owner": "nikku",
"repo": "testtest",
"path": ".github/merge-me.yml"
},
"result": {
"config": { }
}
}
20 changes: 20 additions & 0 deletions test/fixtures/merge_error/006_repos.getBranchProtection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "repos.getBranchProtection",
"type": "api-call",
"args": {
"owner": "nikku",
"repo": "testtest",
"branch": "master"
},
"result": {
"data": {
"required_status_checks": {
"contexts": [
"Travis CI - Pull Request"
]
},
"required_pull_request_reviews": {},
"enforce_admins": {}
}
}
}
16 changes: 16 additions & 0 deletions test/fixtures/merge_error/007_pulls.merge.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "pulls.merge",
"type": "api-call",
"args": {
"owner": "nikku",
"repo": "testtest",
"pull_number": 29,
"sha": "53e4600f2c01d18a8005f0f3e857c701fed8a9e0",
"merge_method": "rebase"
},
"result": {
"error": {
"message": "intended failure"
}
}
}
56 changes: 56 additions & 0 deletions test/fixtures/merge_error/008_status.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "status",
"type": "event",
"payload": {
"sha": "53e4600f2c01d18a8005f0f3e857c701fed8a9e0",
"name": "nikku/testtest",
"context": "continuous-integration/travis-ci/pr",
"state": "pending",
"commit": {
"sha": "53e4600f2c01d18a8005f0f3e857c701fed8a9e0",
"commit": {
"author": {
"name": "Nico Rehwaldt"
},
"committer": {
"name": "GitHub"
},
"message": "Update test.txt",
"tree": {
"sha": "911f57504612def9e96f0991fc84d59e078ec674"
},
"comment_count": 0
},
"author": {
"login": "nikku",
"type": "User"
},
"committer": {
"login": "web-flow",
"type": "User"
},
"parents": [
{
"sha": "c5de67566cca3f699aab82e92dc930d964587f2a"
}
]
},
"branches": [
{
"name": "nikku-patch-1",
"commit": {
"sha": "53e4600f2c01d18a8005f0f3e857c701fed8a9e0"
}
}
],
"repository": {
"name": "testtest",
"full_name": "nikku/testtest",
"owner": {
"login": "nikku",
"type": "User"
},
"default_branch": "master"
}
}
}
3 changes: 3 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ describe('bot', function() {
// mergeMethod is <dont-care>
it('should handle config errors', test('config_errors'));


it('should handle merge error', test('merge_error'));

});


Expand Down

0 comments on commit 1b68ad3

Please sign in to comment.