Skip to content

Commit ab676e0

Browse files
add test for NewPullRequestData.from() for grouped update
1 parent 676b193 commit ab676e0

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

modules/core/src/test/scala/org/scalasteward/core/forge/data/NewPullRequestDataTest.scala

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,4 +622,89 @@ class NewPullRequestDataTest extends FunSuite {
622622

623623
assertEquals(obtained, expected)
624624
}
625+
626+
test("from() should construct NewPullRequestData for groupped update") {
627+
val update1 = ("ch.qos.logback".g % "logback-classic".a % "1.2.0" %> "1.2.3").single
628+
val update2 = ("com.example".g % "foo".a % "1.0.0" %> "2.0.0").single
629+
val update = Update.Grouped("my-group", None, List(update1, update2))
630+
631+
val data = UpdateData(
632+
repoData = RepoData(
633+
repo = Repo("foo", "bar"),
634+
cache = dummyRepoCache,
635+
config = RepoConfig(assignees = List("foo"), reviewers = List("bar"))
636+
),
637+
fork = Repo("scala-steward", "bar"),
638+
update = update,
639+
baseBranch = Branch("main"),
640+
baseSha1 = dummySha1,
641+
updateBranch = Branch("update/logback-classic-1.2.3")
642+
)
643+
val obtained = from(
644+
data,
645+
"scala-steward:update/logback-classic-1.2.3",
646+
labels = labelsFor(data.update)
647+
)
648+
649+
val expectedBody =
650+
s"""|Updates:
651+
|
652+
|* ch.qos.logback:logback-classic from 1.2.0 to 1.2.3
653+
|* com.example:foo from 1.0.0 to 2.0.0
654+
|
655+
|
656+
|I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.
657+
|
658+
|If you have any feedback, just mention me in the comments below.
659+
|
660+
|Configure Scala Steward for your repository with a [`.scala-steward.conf`](https://github.com/scala-steward-org/scala-steward/blob/${org.scalasteward.core.BuildInfo.gitHeadCommit}/docs/repo-specific-configuration.md) file.
661+
|
662+
|Have a fantastic day writing Scala!
663+
|
664+
|<details>
665+
|<summary>Adjust future updates</summary>
666+
|
667+
|Add these to your `.scala-steward.conf` file to ignore future updates of these dependencies:
668+
|```
669+
|updates.ignore = [
670+
| { groupId = "ch.qos.logback", artifactId = "logback-classic" },
671+
| { groupId = "com.example", artifactId = "foo" }
672+
|]
673+
|```
674+
|Or, add these to slow down future updates of these dependencies:
675+
|```
676+
|dependencyOverrides = [
677+
| {
678+
| pullRequests = { frequency = "30 days" },
679+
| dependency = { groupId = "ch.qos.logback", artifactId = "logback-classic" }
680+
| },
681+
| {
682+
| pullRequests = { frequency = "30 days" },
683+
| dependency = { groupId = "com.example", artifactId = "foo" }
684+
| }
685+
|]
686+
|```
687+
|</details>
688+
|
689+
|labels: library-update, early-semver-patch, semver-spec-patch, early-semver-major, semver-spec-major, commit-count:0""".stripMargin
690+
691+
val expected = NewPullRequestData(
692+
title = "Update for group my-group",
693+
body = expectedBody,
694+
head = "scala-steward:update/logback-classic-1.2.3",
695+
base = Branch("main"),
696+
labels = List(
697+
"library-update",
698+
"early-semver-patch",
699+
"semver-spec-patch",
700+
"early-semver-major",
701+
"semver-spec-major",
702+
"commit-count:0"
703+
),
704+
assignees = List("foo"),
705+
reviewers = List("bar")
706+
)
707+
708+
assertEquals(obtained, expected)
709+
}
625710
}

0 commit comments

Comments
 (0)