Skip to main content

Module testing

Module testing 

Source
Expand description

The test client.

Requests go straight through the router โ€” no socket, no port, no waiting โ€” so an HTTP test costs about as much as calling a function:

โ“˜
let client = TestClient::new(router);
client.get("/users").await.assert_ok().assert_see("Ada");

Structsยง

TestClient
TestResponse
A response with assertions attached, each returning self so they chain.