Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
kfbustam committed Dec 9, 2024
1 parent 6f1f905 commit 7a4fedd
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
3 changes: 2 additions & 1 deletion source/platforms/_tests/fixtures/bbc-dsl-input.json
Original file line number Diff line number Diff line change
Expand Up @@ -2542,7 +2542,8 @@
"settings": {
"github": {
"accessToken": "12345",
"additionalHeaders": {}
"additionalHeaders": {},
"baseURL": "https://api.github.com"
},
"cliArgs": {}
}
Expand Down
3 changes: 2 additions & 1 deletion source/platforms/_tests/fixtures/bbs-dsl-input.json
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,8 @@
"settings": {
"github": {
"accessToken": "12345",
"additionalHeaders": {}
"additionalHeaders": {},
"baseURL": "https://api.github.com"
},
"cliArgs": {}
}
Expand Down
33 changes: 33 additions & 0 deletions source/platforms/_tests/fixtures/github_comments_with_danger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[
{
"id": 1,
"node_id": "MDEyOklzc3VlQ29tbWVudDE=",
"url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1",
"html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1",
"body": "Me too",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"created_at": "2011-04-14T16:00:49Z",
"updated_at": "2011-04-14T16:00:49Z",
"issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
"author_association": "COLLABORATOR"
}
]
8 changes: 8 additions & 0 deletions source/platforms/github/_tests/_github_api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ new file mode 0
expect(commentIDs.length).toEqual(0)
})

it("getPullRequestComment gets only comments for given Pull Request", async () => {
api.getAllOfResource = await requestWithFixturedJSON("github_pr_comments_with_danger.json")

const comments = await api.getPullRequestComments()

expect(comments.length).toEqual(1)
})

it("getPullRequestInlineComment gets only comments for given dangerID", async () => {
api.getAllOfResource = await requestWithFixturedJSON("github_inline_comments_with_danger.json")

Expand Down

0 comments on commit 7a4fedd

Please sign in to comment.