File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
js/src/test/scala/com/azavea/stac4s/api/client
jvm/src/test/scala/com/azavea/stac4s/api/client Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 11package com .azavea .stac4s .api .client
22
33import com .azavea .stac4s .testing .JsInstances
4-
54import cats .syntax .either ._
65import eu .timepit .refined .types .all .NonEmptyString
76import io .circe .JsonObject
87import io .circe .syntax ._
8+ import org .scalatest .BeforeAndAfterAll
99import org .scalatest .funspec .AnyFunSpec
1010import org .scalatest .matchers .should .Matchers
1111import sttp .client3 .testing .SttpBackendStub
1212import sttp .client3 .{Response , UriContext }
1313import sttp .monad .EitherMonad
1414
15- class StacClientSpec extends AnyFunSpec with Matchers with JsInstances {
15+ class StacClientSpec extends AnyFunSpec with Matchers with JsInstances with BeforeAndAfterAll {
1616
1717 lazy val backend =
1818 SttpBackendStub (EitherMonad )
@@ -69,4 +69,6 @@ class StacClientSpec extends AnyFunSpec with Matchers with JsInstances {
6969 .size should be > 0
7070 }
7171 }
72+
73+ override def afterAll (): Unit = backend.close().valueOr(throw _)
7274}
Original file line number Diff line number Diff line change 11package com .azavea .stac4s .api .client
22
33import com .azavea .stac4s .testing .JvmInstances
4-
54import cats .effect .{Blocker , IO }
65import cats .syntax .applicative ._
76import cats .syntax .either ._
@@ -10,15 +9,16 @@ import eu.timepit.refined.collection.Empty
109import eu .timepit .refined .types .all .NonEmptyString
1110import io .circe .JsonObject
1211import io .circe .syntax ._
12+ import org .scalatest .BeforeAndAfterAll
1313import sttp .client3 .asynchttpclient .cats .AsyncHttpClientCatsBackend
1414import sttp .client3 .http4s .Http4sBackend
1515import sttp .client3 .impl .cats .CatsMonadAsyncError
1616import sttp .client3 .testing .SttpBackendStub
1717import sttp .client3 .{Response , UriContext }
1818
19- class StacClientSpec extends IOSpec with JvmInstances {
19+ class StacClientSpec extends IOSpec with JvmInstances with BeforeAndAfterAll {
2020
21- lazy val backend : SttpBackendStub [ IO , Nothing ] =
21+ lazy val backend =
2222 SttpBackendStub (new CatsMonadAsyncError [IO ]())
2323 .whenRequestMatches(_.uri.path == Seq (" search" ))
2424 .thenRespondF { _ =>
@@ -88,4 +88,6 @@ class StacClientSpec extends IOSpec with JvmInstances {
8888 res map (_ shouldNot be(Empty ))
8989 }
9090 }
91+
92+ override def afterAll (): Unit = backend.close().unsafeRunSync()
9193}
You can’t perform that action at this time.
0 commit comments