munit
package munit
- Alphabetic
- By Inheritance
- munit
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- abstract class Http4sAuthedRoutesSuite[A] extends Http4sSuite[AuthedRequest[IO, A]]
Base class for suites testing
AuthedRoutes
.Base class for suites testing
AuthedRoutes
.To use this class you'll need to provide the routes being tested by overriding
routes
.Ensure that a
Show
instance for the request's context type is in scope. This instance will be used to include the context's information in the test's name.import cats.effect.IO import org.http4s.AuthedRoutes import org.http4s.client.dsl.io._ import org.http4s.dsl.io._ import org.http4s.syntax.all._ class MyAuthedRoutesSuite extends munit.Http4sAuthedRoutesSuite[String] { override val routes: AuthedRoutes[String, IO] = AuthedRoutes.of { case GET -> Root / "hello" as user => Ok(user + " says Hi") } test(GET(uri"hello").as("Jose")) { response => assertIO(response.as[String], "Jose says Hi") } }
Example: - abstract class Http4sHttpRoutesSuite extends Http4sSuite[Request[IO]]
Base class for suites testing
HttpRoutes
.Base class for suites testing
HttpRoutes
.To use this class you'll need to provide the routes being tested by overriding
routes
.import cats.effect.IO import org.http4s.HttpRoutes import org.http4s.client.dsl.io._ import org.http4s.dsl.io._ import org.http4s.syntax.all._ class MyHttpRoutesSuite extends munit.Http4sHttpRoutesSuite[String] { override val routes: HttpRoutes[IO] = HttpRoutes.of { case GET -> Root / "hello" => Ok("Hello!") } test(GET(uri"hello")) { response => assertIO(response.as[String], "Hello!") } }
Example: - final case class Http4sMUnitConfig(repetitions: Option[Int], maxParallel: Option[Int], showAllStackTraces: Option[Boolean]) extends Product with Serializable
Test's configuration.
Test's configuration.
- repetitions
number of times a test must be repeated
- maxParallel
maximum number of repetitions to run in parallel
- showAllStackTraces
if all stacktraces should be printed when multiple failures occurred in a repeated test
- abstract class Http4sSuite[Request] extends CatsEffectSuite
Base class for all of the other suites using http4s' requests to test HTTP servers/routes.
- abstract class HttpSuite extends Http4sSuite[Request[IO]] with CatsEffectFunFixtures
Base class for suites testing remote HTTP servers.
Base class for suites testing remote HTTP servers.
To use this class you'll need to provide the
Uri
of the remote container by overridingbaseUri
.import scala.concurrent.ExecutionContext.global import cats.effect.IO import cats.effect.Resource import io.circe.Json import org.http4s.Method.GET import org.http4s.Uri import org.http4s.circe._ import org.http4s.client.Client import org.http4s.ember.client.EmberClientBuilder import org.http4s.client.dsl.io._ import org.http4s.syntax.all._ class HttpSuiteSuite extends munit.HttpSuite { override def http4sMUnitClient: Resource[IO, Client[IO]] = BlazeClientBuilder[IO](global).resource override def baseUri(): Uri = uri"https://api.github.com" test(GET(uri"users/gutiory")) { response => assertEquals(response.status.code, 200) val result = response.as[Json].map(_.hcursor.get[String]("login")) assertIO(result, Right("gutiory")) } }
Example:
Value Members
- val Fail: Tag
- val Flaky: Tag
- val Ignore: Tag
- val Only: Tag
- val Slow: Tag
- object Http4sMUnitConfig extends Serializable
- object Http4sMUnitDefaults