Skip to content

Commit

Permalink
Remove InvalidVersions from Update.newerVersions
Browse files Browse the repository at this point in the history
closes #371
  • Loading branch information
fthomas committed May 16, 2019
1 parent 2ea66e7 commit 3f9eedf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ object parser {
artifactId <- Either.fromOption(moduleId.lift(1), msg("artifactId"))
configurations = moduleId.lift(2)
currentVersion <- Either.fromOption(versions.headOption, msg("currentVersion"))
maybeNewerVersions = Nel.fromList(versions.drop(1).toList)
newerVersions <- Either.fromOption(maybeNewerVersions, msg("newerVersions"))
newerVersionsList = versions.drop(1).toList.filterNot(_.startsWith("InvalidVersion"))
newerVersions <- Either.fromOption(Nel.fromList(newerVersionsList), msg("newerVersions"))
} yield Update.Single(groupId, artifactId, currentVersion, newerVersions, configurations)

case _ => Left(s"'$str' must contain ' : ' exactly once")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ class parserTest extends FunSuite with Matchers {
parseSingleUpdate(str).isLeft
}

test("parseSingleUpdate: all new versions are invalid") {
val str =
"bigdataoss:gcs-connector : hadoop2-1.9.16 -> InvalidVersion(hadoop3-2.0.0-SNAPSHOT)"
parseSingleUpdate(str).isLeft
}

test("parseSingleUpdate: one new version is invalid") {
val str =
"bigdataoss:gcs-connector : hadoop2-1.9.16 -> InvalidVersion(hadoop3-2.0.0-SNAPSHOT) -> 1.9.4-hadoop3"
parseSingleUpdate(str) shouldBe Right(
Update.Single("bigdataoss", "gcs-connector", "hadoop2-1.9.16", Nel.of("1.9.4-hadoop3"))
)
}

test("parseSingleUpdates 1") {
val str =
"""[info] Found 3 dependency updates for datapackage
Expand Down

0 comments on commit 3f9eedf

Please sign in to comment.