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 1
1
package com .azavea .stac4s .api .client
2
2
3
3
import com .azavea .stac4s .testing .JsInstances
4
-
5
4
import cats .syntax .either ._
6
5
import eu .timepit .refined .types .all .NonEmptyString
7
6
import io .circe .JsonObject
8
7
import io .circe .syntax ._
8
+ import org .scalatest .BeforeAndAfterAll
9
9
import org .scalatest .funspec .AnyFunSpec
10
10
import org .scalatest .matchers .should .Matchers
11
11
import sttp .client3 .testing .SttpBackendStub
12
12
import sttp .client3 .{Response , UriContext }
13
13
import sttp .monad .EitherMonad
14
14
15
- class StacClientSpec extends AnyFunSpec with Matchers with JsInstances {
15
+ class StacClientSpec extends AnyFunSpec with Matchers with JsInstances with BeforeAndAfterAll {
16
16
17
17
lazy val backend =
18
18
SttpBackendStub (EitherMonad )
@@ -69,4 +69,6 @@ class StacClientSpec extends AnyFunSpec with Matchers with JsInstances {
69
69
.size should be > 0
70
70
}
71
71
}
72
+
73
+ override def afterAll (): Unit = backend.close().valueOr(throw _)
72
74
}
Original file line number Diff line number Diff line change 1
1
package com .azavea .stac4s .api .client
2
2
3
3
import com .azavea .stac4s .testing .JvmInstances
4
-
5
4
import cats .effect .{Blocker , IO }
6
5
import cats .syntax .applicative ._
7
6
import cats .syntax .either ._
@@ -10,15 +9,16 @@ import eu.timepit.refined.collection.Empty
10
9
import eu .timepit .refined .types .all .NonEmptyString
11
10
import io .circe .JsonObject
12
11
import io .circe .syntax ._
12
+ import org .scalatest .BeforeAndAfterAll
13
13
import sttp .client3 .asynchttpclient .cats .AsyncHttpClientCatsBackend
14
14
import sttp .client3 .http4s .Http4sBackend
15
15
import sttp .client3 .impl .cats .CatsMonadAsyncError
16
16
import sttp .client3 .testing .SttpBackendStub
17
17
import sttp .client3 .{Response , UriContext }
18
18
19
- class StacClientSpec extends IOSpec with JvmInstances {
19
+ class StacClientSpec extends IOSpec with JvmInstances with BeforeAndAfterAll {
20
20
21
- lazy val backend : SttpBackendStub [ IO , Nothing ] =
21
+ lazy val backend =
22
22
SttpBackendStub (new CatsMonadAsyncError [IO ]())
23
23
.whenRequestMatches(_.uri.path == Seq (" search" ))
24
24
.thenRespondF { _ =>
@@ -88,4 +88,6 @@ class StacClientSpec extends IOSpec with JvmInstances {
88
88
res map (_ shouldNot be(Empty ))
89
89
}
90
90
}
91
+
92
+ override def afterAll (): Unit = backend.close().unsafeRunSync()
91
93
}
You can’t perform that action at this time.
0 commit comments