final case class TestClient(behavior: Ref[HttpApp[Any, Throwable]], serverSocketBehavior: Ref[SocketApp[Any]]) extends Client
Enables tests that use a client without needing a live Server
- Value parameters:
- behavior
Contains the user-specified behavior that takes the place of the usual Server
- Companion:
- object
Value members
Concrete methods
def addHandler[R](handler: PartialFunction[Request, ZIO[R, Throwable, Response]]): ZIO[R, Nothing, Unit]
Adds a flexible handler for requests that are submitted by test cases
Adds a flexible handler for requests that are submitted by test cases
- Type parameters:
- R
Environment of the new handler's effect.
- Value parameters:
- handler
New behavior to be added to the TestClient
- Example:
TestClient.addHandler{case request if request.method == Method.GET => ZIO.succeed(Response.ok)}
Adds an exact 1-1 behavior
Adds an exact 1-1 behavior
- Value parameters:
- expectedRequest
The request that will trigger the response
- response
The response to be returned when a user submits the response
- Example:
TestClient.addRequestResponse(Request.get(URL.root), Response.ok)
def installSocketApp[Env1](app: Http[Any, Throwable, WebSocketChannelEvent, Unit]): ZIO[Env1, Nothing, Unit]
Inherited methods
final def contramapZIO[Env1, Err1 >: Throwable, In2](f: In2 => ZIO[Env1, Err1, Body]): ZClient[Env1, In2, Err1, Out]
- Inherited from:
- ZClient
final def refineOrDie[Err2](pf: PartialFunction[Throwable, Err2])(implicit ev1: IsSubtypeOfError[Throwable, Throwable], ev2: CanFail[Throwable], trace: Trace): ZClient[Env, In, Err2, Out]
- Inherited from:
- ZClient