mod broken;
mod mock;
mod restricted;
#[cfg(test)]
pub use mock::connector::MockConnector;
pub use mock::subgraph::MockSubgraph;
pub(crate) use self::mock::canned;
#[cfg(test)]
pub(crate) async fn await_mock_driver(driver: tokio::task::JoinHandle<()>) {
tokio::time::timeout(std::time::Duration::from_secs(5), driver)
.await
.expect("mock driver timed out — service was not called within 5 s")
.expect("mock driver panicked");
}
#[cfg(test)]
pub(crate) async fn assert_no_mock_calls<Req, Res>(mut handle: tower_test::mock::Handle<Req, Res>)
where
Req: Send + 'static,
Res: Send + 'static,
{
if matches!(
tokio::time::timeout(std::time::Duration::from_millis(10), handle.next_request(),).await,
Ok(Some(_))
) {
panic!("mock service was called but should not have been");
}
}