@@ -193,10 +193,20 @@ class NewPullRequestDataTest extends FunSuite {
193193 val update1 = (" ch.qos.logback" .g % " logback-classic" .a % " 1.2.0" %> " 1.2.3" ).single
194194 val update2 = (" com.example" .g % " foo" .a % " 1.0.0" %> " 2.0.0" ).single
195195 val update = Update .Grouped (" my-group" , Some (" The PR title" ), List (update1, update2))
196+ val edits = List (
197+ UpdateEdit (
198+ update = (" ch.qos.logback" .g % " logback-classic" .a % " 1.2.0" %> " 1.2.3" ).single,
199+ commit = Commit (dummySha1)
200+ ),
201+ UpdateEdit (
202+ update = (" com.example" .g % " foo" .a % " 1.0.0" %> " 2.0.0" ).single,
203+ commit = Commit (dummySha1)
204+ )
205+ )
196206
197207 val body = bodyFor(
198208 update = update,
199- edits = List .empty ,
209+ edits = edits ,
200210 artifactIdToUrl = Map .empty,
201211 artifactIdToUpdateInfoUrls = Map .empty,
202212 filesWithOldVersion = List .empty,
@@ -398,6 +408,107 @@ class NewPullRequestDataTest extends FunSuite {
398408 assertEquals(body, expected)
399409 }
400410
411+ test(" bodyFor() grouped update when edits does not contain an update (scala-steward:off case)" ) {
412+ val update1 = (" ch.qos.logback" .g % " logback-classic" .a % " 1.2.0" %> " 1.2.3" ).single
413+ val update2 = (" com.example" .g % " foo" .a % " 1.0.0" %> " 2.0.0" ).single
414+ val update = Update .Grouped (" my-group" , Some (" The PR title" ), List (update1, update2))
415+ val edits = List (
416+ UpdateEdit (
417+ update = (" ch.qos.logback" .g % " logback-classic" .a % " 1.2.0" %> " 1.2.3" ).single,
418+ commit = Commit (dummySha1)
419+ )
420+ )
421+
422+ val body = bodyFor(
423+ update = update,
424+ edits = edits,
425+ artifactIdToUrl = Map .empty,
426+ artifactIdToUpdateInfoUrls = Map .empty,
427+ filesWithOldVersion = List .empty,
428+ configParsingError = None ,
429+ labels = List (" library-update" ),
430+ maximumPullRequestLength = 65536
431+ )
432+ val expected =
433+ s """ |## About this PR
434+ |Updates:
435+ |
436+ |* 📦 ch.qos.logback:logback-classic from `1.2.0` to `1.2.3`
437+ |
438+ |## Usage
439+ |✅ **Please merge!**
440+ |
441+ |I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.
442+ |
443+ |If you have any feedback, just mention me in the comments below.
444+ |
445+ |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.
446+ |
447+ |_Have a fantastic day writing Scala!_
448+ |
449+ |<details>
450+ |<summary>⚙ Adjust future updates</summary>
451+ |
452+ |Add these to your `.scala-steward.conf` file to ignore future updates of these dependencies:
453+ |```
454+ |updates.ignore = [
455+ | { groupId = "ch.qos.logback", artifactId = "logback-classic" }
456+ |]
457+ |```
458+ |Or, add these to slow down future updates of these dependencies:
459+ |```
460+ |dependencyOverrides = [
461+ | {
462+ | pullRequests = { frequency = "30 days" },
463+ | dependency = { groupId = "ch.qos.logback", artifactId = "logback-classic" }
464+ | }
465+ |]
466+ |```
467+ |</details>
468+ |
469+ |<sup>
470+ |labels: library-update
471+ |</sup>
472+ |
473+ |<!-- scala-steward = {
474+ | "Update" : {
475+ | "Grouped" : {
476+ | "name" : "my-group",
477+ | "title" : "The PR title",
478+ | "updates" : [
479+ | {
480+ | "ForArtifactId" : {
481+ | "crossDependency" : [
482+ | {
483+ | "groupId" : "ch.qos.logback",
484+ | "artifactId" : {
485+ | "name" : "logback-classic",
486+ | "maybeCrossName" : null
487+ | },
488+ | "version" : "1.2.0",
489+ | "sbtVersion" : null,
490+ | "scalaVersion" : null,
491+ | "configurations" : null
492+ | }
493+ | ],
494+ | "newerVersions" : [
495+ | "1.2.3"
496+ | ],
497+ | "newerGroupId" : null,
498+ | "newerArtifactId" : null
499+ | }
500+ | }
501+ | ]
502+ | }
503+ | },
504+ | "Labels" : [
505+ | "library-update"
506+ | ]
507+ |} --> """ .stripMargin
508+
509+ assertEquals(body, expected)
510+ }
511+
401512 test(" fromTo" ) {
402513 val obtained = fromTo((" com.example" .g % " foo" .a % " 1.2.0" %> " 1.2.3" ).single)
403514 assertEquals(obtained, " from `1.2.0` to `1.2.3`" )
@@ -837,6 +948,16 @@ class NewPullRequestDataTest extends FunSuite {
837948 val update1 = (" ch.qos.logback" .g % " logback-classic" .a % " 1.2.0" %> " 1.2.3" ).single
838949 val update2 = (" com.example" .g % " foo" .a % " 1.0.0" %> " 2.0.0" ).single
839950 val update = Update .Grouped (" my-group" , None , List (update1, update2))
951+ val edits = List (
952+ UpdateEdit (
953+ update = (" ch.qos.logback" .g % " logback-classic" .a % " 1.2.0" %> " 1.2.3" ).single,
954+ commit = Commit (dummySha1)
955+ ),
956+ UpdateEdit (
957+ update = (" com.example" .g % " foo" .a % " 1.0.0" %> " 2.0.0" ).single,
958+ commit = Commit (dummySha1)
959+ )
960+ )
840961
841962 val data = UpdateData (
842963 repoData = RepoData (
@@ -851,8 +972,9 @@ class NewPullRequestDataTest extends FunSuite {
851972 updateBranch = Branch (" update/logback-classic-1.2.3" )
852973 )
853974 val obtained = from(
854- data,
855- " scala-steward:update/logback-classic-1.2.3" ,
975+ data = data,
976+ branchName = " scala-steward:update/logback-classic-1.2.3" ,
977+ edits = edits,
856978 addLabels = true ,
857979 labels = labelsFor(data.update)
858980 )
0 commit comments