http4js
Table of Contents
- Overview
- Handlers and Filters
- Request and Response API
- URI API
- Routing API
- In Memory Testing
- End to End Testing
- Approval testing with fakes
- Zipkin tracing
- Https Server
- Proxy
- Use in Javascript
- Example App
End to End Testing
If we have called asServer() then our Routing knows about a server.
We can then call serveE2E(req) with a Req and it will start the server,
pass the Req to our HttpClient which will make the Req over the wire.
We then call stop() on the server… and we have served a Req end to end!
const routing = get("/path", async (req: Req) => ResOf(200))
.asServer()
routing.serveE2E(ReqOf("GET", "/path"))
/*
Res {
headers:
{ date: 'Tue, 26 Jun 2018 08:04:21 GMT',
connection: 'close',
'transfer-encoding': 'chunked' },
status: 200,
body: '' }
*/
This is a quick way to write end to end tests.
Prev: In Memory Testing