Closed carlosedp closed 1 year ago
Describe the bug Tests for requests break after the 0.0.4 update. Same app and test work on 0.0.3.
A simple app and test like:
object GreetingApp { def apply(): Http[Any, Nothing, Request, Response] = Http.collectZIO[Request] { // GET /greet case Method.GET -> !! / "greet" => // httpHitsMetric("GET", "/greet").increment. ZIO.succeed(Response.text("Hello World!")) @@ MetricsApp.httpHitsMetric("GET", "/greet") } } // Test object GreetingAppSpec extends ZIOSpecDefault { val greetApp = GreetingApp() def spec = suite("Greet application")( test("should greet world") { for { response <- greetApp(Request.get(URL(!! / "greet"))) body <- response.body.asString } yield assertTrue( response.status == Status.Ok, body == "Hello World!", ) } ) }
After 0.0.4 presents the error:
❯ ./mill backend.test [64/74] backend.test.compile [info] compiling 2 Scala sources to /Users/cdepaula/repos/scala-playground/zio-scalajs-stack/out/backend/test/compile.dest/classes ... [error] -- [E050] Type Error: /Users/cdepaula/repos/scala-playground/zio-scalajs-stack/backend/test/src/GreetingAppSpec.scala:15:22 [error] 15 | response <- greetApp(Request.get(URL(!! / "greet"))) [error] | ^^^^^^^^ [error] | value greetApp in object GreetingAppSpec does not take parameters [error] |---------------------------------------------------------------------------- [error] | Explanation (enabled by `-explain`) [error] |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [error] | You have specified more parameter lists than defined in the method definition(s). [error] ---------------------------------------------------------------------------- [error] Explanation [error] =========== [error] You have specified more parameter lists than defined in the method definition(s).
Expected behaviour Test to pass as in 0.0.3.
This is an intentional API change. Instead of using apply you now have to call runZIO
apply
runZIO
greetApp.runZIO(Request.get(URL(!! / "greet")))
Describe the bug Tests for requests break after the 0.0.4 update. Same app and test work on 0.0.3.
A simple app and test like:
After 0.0.4 presents the error:
Expected behaviour Test to pass as in 0.0.3.