Skip to content

Commit

Permalink
Adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pomadchin committed Nov 21, 2023
1 parent 5d7fd2f commit 7e05535
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions store/src/main/scala/geotrellis/store/GeoTrellisPath.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ object GeoTrellisPath {
implicit def toGeoTrellisDataPath(path: String): GeoTrellisPath = parse(path)

def parseOption(path: String): Option[GeoTrellisPath] = {
val layerNameParam: String = "layer"
val zoomLevelParam: String = "zoom"
val bandCountParam: String = "band_count"
val layerNameParam = "layer"
val zoomLevelParam = "zoom"
val bandCountParam = "band_count"

val uri = UrlWithAuthority.parseOption(path).fold(Url.parse(path))(identity)
val queryString = uri.query
Expand All @@ -79,9 +79,9 @@ object GeoTrellisPath {
}

catalogPath.fold(Option.empty[GeoTrellisPath]) { catalogPath =>
val maybeLayerName: Option[String] = queryString.param(layerNameParam)
val maybeZoomLevel: Option[Int] = queryString.param(zoomLevelParam).map(_.toInt)
val bandCount: Option[Int] = queryString.param(bandCountParam).map(_.toInt)
val maybeLayerName = queryString.param(layerNameParam)
val maybeZoomLevel = queryString.param(zoomLevelParam).map(_.toInt)
val bandCount = queryString.param(bandCountParam).map(_.toInt)

(maybeLayerName, maybeZoomLevel) match {
case (Some(layerName), Some(zoomLevel)) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class GeoTrellisPathSpec extends AnyFunSpec {

it("should ignore invalid parameters") {
val path = GeoTrellisPath.parse("file:///foo/bar?layer=baz&zoom=1&invalid=not&nope=1")
assert(path == GeoTrellisPath("file:///foo/bar", "baz", 1, None))
assert(path == GeoTrellisPath("file:///foo/bar?invalid=not&nope=1", "baz", 1, None))
}
}
}

0 comments on commit 7e05535

Please sign in to comment.