diff --git a/modules/client/js/src/test/scala/com/azavea/stac4s/api/client/StacClientSpec.scala b/modules/client/js/src/test/scala/com/azavea/stac4s/api/client/StacClientSpec.scala index 42375852..36f195a1 100644 --- a/modules/client/js/src/test/scala/com/azavea/stac4s/api/client/StacClientSpec.scala +++ b/modules/client/js/src/test/scala/com/azavea/stac4s/api/client/StacClientSpec.scala @@ -1,18 +1,18 @@ package com.azavea.stac4s.api.client import com.azavea.stac4s.testing.JsInstances - import cats.syntax.either._ import eu.timepit.refined.types.all.NonEmptyString import io.circe.JsonObject import io.circe.syntax._ +import org.scalatest.BeforeAndAfterAll import org.scalatest.funspec.AnyFunSpec import org.scalatest.matchers.should.Matchers import sttp.client3.testing.SttpBackendStub import sttp.client3.{Response, UriContext} import sttp.monad.EitherMonad -class StacClientSpec extends AnyFunSpec with Matchers with JsInstances { +class StacClientSpec extends AnyFunSpec with Matchers with JsInstances with BeforeAndAfterAll { lazy val backend = SttpBackendStub(EitherMonad) @@ -69,4 +69,6 @@ class StacClientSpec extends AnyFunSpec with Matchers with JsInstances { .size should be > 0 } } + + override def afterAll(): Unit = backend.close() } diff --git a/modules/client/jvm/src/test/scala/com/azavea/stac4s/api/client/StacClientSpec.scala b/modules/client/jvm/src/test/scala/com/azavea/stac4s/api/client/StacClientSpec.scala index 5bf9eb82..0d721714 100644 --- a/modules/client/jvm/src/test/scala/com/azavea/stac4s/api/client/StacClientSpec.scala +++ b/modules/client/jvm/src/test/scala/com/azavea/stac4s/api/client/StacClientSpec.scala @@ -1,7 +1,6 @@ package com.azavea.stac4s.api.client import com.azavea.stac4s.testing.JvmInstances - import cats.effect.{Blocker, IO} import cats.syntax.applicative._ import cats.syntax.either._ @@ -10,15 +9,16 @@ import eu.timepit.refined.collection.Empty import eu.timepit.refined.types.all.NonEmptyString import io.circe.JsonObject import io.circe.syntax._ +import org.scalatest.BeforeAndAfterAll import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend import sttp.client3.http4s.Http4sBackend import sttp.client3.impl.cats.CatsMonadAsyncError import sttp.client3.testing.SttpBackendStub import sttp.client3.{Response, UriContext} -class StacClientSpec extends IOSpec with JvmInstances { +class StacClientSpec extends IOSpec with JvmInstances with BeforeAndAfterAll { - lazy val backend: SttpBackendStub[IO, Nothing] = + lazy val backend = SttpBackendStub(new CatsMonadAsyncError[IO]()) .whenRequestMatches(_.uri.path == Seq("search")) .thenRespondF { _ => @@ -88,4 +88,6 @@ class StacClientSpec extends IOSpec with JvmInstances { res map (_ shouldNot be(Empty)) } } + + override def afterAll(): Unit = backend.close() }