p

munit

package munit

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. munit
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. 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.

    Example:
    1. import cats.effect.IO
      
      import org.http4s.AuthedRoutes
      
      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")
        }
      
      }
  2. 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.

    Example:
    1. import cats.effect.IO
      
      import org.http4s.HttpRoutes
      
      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!")
        }
      
      }
  3. 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

  4. abstract class Http4sSuite[Request] extends CatsEffectSuite with Http4sDsl[IO] with Http4sClientDsl[IO] with AllSyntax

    Base class for all of the other suites using http4s' requests to test HTTP servers/routes.

  5. 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 server by overriding baseUri.

    By default this class uses Ember as the client to connect to the server. If you don't want to use this specific client you will need to override the http4sMUnitClient value.

    Example:
    1. import scala.concurrent.ExecutionContext.global
      
      import cats.effect.IO
      import cats.effect.Resource
      
      import io.circe.Json
      import org.http4s.Uri
      import org.http4s.circe._
      import org.http4s.client.Client
      import org.http4s.ember.client.EmberClientBuilder
      
      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"))
        }
      
      }

Value Members

  1. val Fail: Tag
  2. val Flaky: Tag
  3. val Ignore: Tag
  4. val Only: Tag
  5. val Slow: Tag
  6. object Http4sMUnitConfig extends Serializable
  7. object Http4sMUnitDefaults

Inherited from AnyRef

Inherited from Any

Ungrouped