Skip to content

Commit b9d4718

Browse files
authored
Merge pull request #2781 from exoego/coverage
Increase coverage
2 parents 39dd8db + 77c9fdb commit b9d4718

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

modules/core/src/test/scala/org/scalasteward/core/vcs/github/GitHubApiAlgTest.scala

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ class GitHubApiAlgTest extends FunSuite {
8888
"body": "Superseded by #1234"
8989
} """)
9090

91+
case POST -> Root / "repos" / "fthomas" / "base.g8" / "pulls" =>
92+
Created(json""" {
93+
"html_url": "https://github.com/octocat/Hello-World/pull/1347",
94+
"state": "open",
95+
"number": 1347,
96+
"title": "new-feature"
97+
} """)
98+
9199
case POST -> Root / "repos" / "fthomas" / "base.g8" / "issues" / IntVar(_) / "labels" =>
92100
// Response taken from https://docs.github.com/en/rest/reference/issues#labels, is ignored
93101
Created(json"""[
@@ -112,6 +120,14 @@ class GitHubApiAlgTest extends FunSuite {
112120

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

123+
private val pullRequest =
124+
PullRequestOut(
125+
uri"https://github.com/octocat/Hello-World/pull/1347",
126+
PullRequestState.Open,
127+
PullRequestNumber(1347),
128+
"new-feature"
129+
)
130+
115131
private val parent = RepoOut(
116132
"base.g8",
117133
UserOut("fthomas"),
@@ -206,6 +222,23 @@ class GitHubApiAlgTest extends FunSuite {
206222
assertEquals(branchOut, defaultCustomBranch)
207223
}
208224

225+
test("createPullRequest") {
226+
val data = NewPullRequestData(
227+
"new-feature",
228+
"body",
229+
"aaa",
230+
Branch("master"),
231+
Nil
232+
)
233+
val pr = gitHubApiAlg.createPullRequest(repo, data).unsafeRunSync()
234+
assertEquals(pr, pullRequest)
235+
}
236+
237+
test("listPullRequests") {
238+
val prs = gitHubApiAlg.listPullRequests(repo, "master", Branch("master")).unsafeRunSync()
239+
assertEquals(prs, List(pullRequest))
240+
}
241+
209242
test("closePullRequest") {
210243
val prOut = gitHubApiAlg.closePullRequest(repo, PullRequestNumber(1347)).unsafeRunSync()
211244
assertEquals(prOut.state, PullRequestState.Closed)

0 commit comments

Comments
 (0)