File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
main/scala/org/scalasteward/core/util
test/scala/org/scalasteward/core/vcs Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ package org.scalasteward.core.util
1919import cats .implicits ._
2020import io .chrisdavenport .log4cats .Logger
2121import org .http4s .client .Client
22- import org .http4s .{Method , Request , Uri }
22+ import org .http4s .{Method , Request , Status , Uri }
2323
2424final class HttpExistenceClient [F [_]](
2525 implicit
@@ -31,7 +31,7 @@ final class HttpExistenceClient[F[_]](
3131
3232 def exists (uri : Uri ): F [Boolean ] = {
3333 val req = Request [F ](method = Method .HEAD , uri = uri)
34- client.status(req).map(_.isSuccess ).handleErrorWith { throwable =>
34+ client.status(req).map(_ === Status . Ok ).handleErrorWith { throwable =>
3535 logger.debug(throwable)(s " Failed to check if $uri exists " ).as(false )
3636 }
3737 }
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ class VCSExtraAlgTest extends FunSuite with Matchers {
1414 val routes : HttpRoutes [IO ] =
1515 HttpRoutes .of[IO ] {
1616 case HEAD -> Root / " foo" / " bar" / " compare" / " v0.1.0...v0.2.0" => Ok (" exist" )
17+ case HEAD -> Root / " foo" / " buz" / " compare" / " v0.1.0...v0.2.0" => PermanentRedirect ()
1718 case _ => NotFound ()
1819 }
1920
@@ -23,6 +24,7 @@ class VCSExtraAlgTest extends FunSuite with Matchers {
2324 val vcsExtraAlg = VCSExtraAlg .create[IO ]
2425 val updateFoo = Update .Single (" com.example" , " foo" , " 0.1.0" , Nel .of(" 0.2.0" ))
2526 val updateBar = Update .Single (" com.example" , " bar" , " 0.1.0" , Nel .of(" 0.2.0" ))
27+ val updateBuz = Update .Single (" com.example" , " buz" , " 0.1.0" , Nel .of(" 0.2.0" ))
2628
2729 test(" getBranchCompareUrl" ) {
2830 vcsExtraAlg.getBranchCompareUrl(None , updateBar).unsafeRunSync() shouldBe None
@@ -32,5 +34,8 @@ class VCSExtraAlgTest extends FunSuite with Matchers {
3234 vcsExtraAlg
3335 .getBranchCompareUrl(Some (" https://github.com/foo/bar" ), updateBar)
3436 .unsafeRunSync() shouldBe Some (" https://github.com/foo/bar/compare/v0.1.0...v0.2.0" )
37+ vcsExtraAlg
38+ .getBranchCompareUrl(Some (" https://github.com/foo/buz" ), updateBuz)
39+ .unsafeRunSync() shouldBe None
3540 }
3641}
You can’t perform that action at this time.
0 commit comments