Skip to content

Commit

Permalink
Merge pull request #2781 from exoego/coverage
Browse files Browse the repository at this point in the history
Increase coverage
  • Loading branch information
exoego authored Nov 18, 2022
2 parents 39dd8db + 77c9fdb commit b9d4718
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ class GitHubApiAlgTest extends FunSuite {
"body": "Superseded by #1234"
} """)

case POST -> Root / "repos" / "fthomas" / "base.g8" / "pulls" =>
Created(json""" {
"html_url": "https://github.com/octocat/Hello-World/pull/1347",
"state": "open",
"number": 1347,
"title": "new-feature"
} """)

case POST -> Root / "repos" / "fthomas" / "base.g8" / "issues" / IntVar(_) / "labels" =>
// Response taken from https://docs.github.com/en/rest/reference/issues#labels, is ignored
Created(json"""[
Expand All @@ -112,6 +120,14 @@ class GitHubApiAlgTest extends FunSuite {

private val repo = Repo("fthomas", "base.g8")

private val pullRequest =
PullRequestOut(
uri"https://github.com/octocat/Hello-World/pull/1347",
PullRequestState.Open,
PullRequestNumber(1347),
"new-feature"
)

private val parent = RepoOut(
"base.g8",
UserOut("fthomas"),
Expand Down Expand Up @@ -206,6 +222,23 @@ class GitHubApiAlgTest extends FunSuite {
assertEquals(branchOut, defaultCustomBranch)
}

test("createPullRequest") {
val data = NewPullRequestData(
"new-feature",
"body",
"aaa",
Branch("master"),
Nil
)
val pr = gitHubApiAlg.createPullRequest(repo, data).unsafeRunSync()
assertEquals(pr, pullRequest)
}

test("listPullRequests") {
val prs = gitHubApiAlg.listPullRequests(repo, "master", Branch("master")).unsafeRunSync()
assertEquals(prs, List(pullRequest))
}

test("closePullRequest") {
val prOut = gitHubApiAlg.closePullRequest(repo, PullRequestNumber(1347)).unsafeRunSync()
assertEquals(prOut.state, PullRequestState.Closed)
Expand Down

0 comments on commit b9d4718

Please sign in to comment.