Skip to content

Add tests for pullRequests.grouping syntax #3654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package org.scalasteward.core.repoconfig

import munit.FunSuite
import org.scalasteward.core.TestSyntax.*

class PullRequestUpdateFilterTest extends FunSuite {

object Update {
val kinesisClient =
("software.amazon.kinesis".g % "amazon-kinesis-client".a % "3.0.2" %> "3.0.3").single
val s3Client = ("software.amazon.awssdk".g % "s3".a % "2.31.60" %> "2.31.61").single
val play = ("org.playframework".g % "sbt-plugin".a % "3.0.6" %> "3.0.7").single
val contentApiClient = ("com.gu".g % "content-api-client".a % "34.1.1" %> "8.1.5").single
val playGoogleAuth = ("com.gu.play-googleauth".g % "play-v30".a % "23.0.0" %> "24.0.0").single
}

test("Allow a wildcard group id") {
val groupFilter = PullRequestUpdateFilter(group = Some("*")).toOption.get

assert(groupFilter.matches(Update.kinesisClient))
assert(groupFilter.matches(Update.s3Client))
assert(groupFilter.matches(Update.play))
}

test("Allow a wildcard-suffix on group id") {
val groupFilter = PullRequestUpdateFilter(group = Some("software.amazon.*")).toOption.get

assert(groupFilter.matches(Update.kinesisClient))
assert(groupFilter.matches(Update.s3Client))

assert(!groupFilter.matches(Update.play))
}

test("Not match a non-wildcard group id if it is only partially specified") {
val groupFilter = PullRequestUpdateFilter(group = Some("software.amazon")).toOption.get

assert(!groupFilter.matches(Update.kinesisClient))
assert(!groupFilter.matches(Update.s3Client))
assert(!groupFilter.matches(Update.play))
}

test("Not match a non-wildcard group id if it is only partially specified") {
val groupFilter = PullRequestUpdateFilter(group = Some("com.gu.*")).toOption.get

assert(!groupFilter.matches(Update.contentApiClient))
assert(groupFilter.matches(Update.playGoogleAuth))
}
}