@@ -88,6 +88,14 @@ class GitHubApiAlgTest extends FunSuite {
88
88
"body": "Superseded by #1234"
89
89
} """ )
90
90
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
+
91
99
case POST -> Root / " repos" / " fthomas" / " base.g8" / " issues" / IntVar (_) / " labels" =>
92
100
// Response taken from https://docs.github.com/en/rest/reference/issues#labels, is ignored
93
101
Created (json """ [
@@ -112,6 +120,14 @@ class GitHubApiAlgTest extends FunSuite {
112
120
113
121
private val repo = Repo (" fthomas" , " base.g8" )
114
122
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
+
115
131
private val parent = RepoOut (
116
132
" base.g8" ,
117
133
UserOut (" fthomas" ),
@@ -206,6 +222,23 @@ class GitHubApiAlgTest extends FunSuite {
206
222
assertEquals(branchOut, defaultCustomBranch)
207
223
}
208
224
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
+
209
242
test(" closePullRequest" ) {
210
243
val prOut = gitHubApiAlg.closePullRequest(repo, PullRequestNumber (1347 )).unsafeRunSync()
211
244
assertEquals(prOut.state, PullRequestState .Closed )
0 commit comments