-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1981 from psttf/master
Added support for GitLab draft MRs
- Loading branch information
Showing
2 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
modules/core/src/test/scala/org/scalasteward/core/vcs/gitlab/MergeRequestPayloadTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.scalasteward.core.vcs.gitlab | ||
|
||
import io.circe.syntax._ | ||
import io.circe.literal._ | ||
import munit.FunSuite | ||
import org.scalasteward.core.git.Branch | ||
import org.scalasteward.core.vcs.data.NewPullRequestData | ||
import org.scalasteward.core.vcs.gitlab.GitLabJsonCodec._ | ||
|
||
class MergeRequestPayloadTest extends FunSuite { | ||
private val master = Branch("master") | ||
private val data = NewPullRequestData( | ||
"Test MR title", | ||
"Test MR body", | ||
"source", | ||
master | ||
) | ||
private val id = "123" | ||
private val projectId = 321L | ||
|
||
test("asJson") { | ||
val obtained = MergeRequestPayload(id, projectId, data).asJson | ||
val expected = | ||
json"""{ | ||
"id" : "123", | ||
"title" : "Test MR title", | ||
"description" : "Test MR body", | ||
"target_project_id" : 321, | ||
"source_branch" : "source", | ||
"target_branch" : "master" | ||
}""" | ||
assertEquals(obtained, expected) | ||
} | ||
|
||
test("asJson for draft MR") { | ||
val obtained = MergeRequestPayload(id, projectId, data.copy(draft = true)).asJson | ||
val expected = | ||
json"""{ | ||
"id" : "123", | ||
"title" : "Draft: Test MR title", | ||
"description" : "Test MR body", | ||
"target_project_id" : 321, | ||
"source_branch" : "source", | ||
"target_branch" : "master" | ||
}""" | ||
assertEquals(obtained, expected) | ||
} | ||
} |