pub async fn create_client<State>(
    state: State,
    setup_routes_fns: impl Into<VariadicRoutes<State>>
) -> TestResult<Client> where
    State: Send + Sync + 'static, 
Expand description

Creates a test application with routes and mocks set up, and hands back a client which is already connected to the server.

Example:

use preroll::test_utils::{self, assert_status, TestResult};

pub fn setup_routes(mut server: tide::Route<'_, std::sync::Arc<()>>) {
  // Normally imported from your service's crate (lib.rs).
}

#[async_std::main] // Would be #[async_std::test] instead.
async fn main() -> TestResult<()> {
    let client = test_utils::create_client((), setup_routes).await.unwrap();

    let mut res = client.get("/monitor/ping").await.unwrap();

    let body = assert_status(&mut res, 200).await;
    assert!(!body.is_empty());
    Ok(())
}