use crate::router::MixtapeRouter;
use std::sync::Arc;
#[test]
fn test_router_builder_type_signature() {
fn _accepts_agent_owned(_: impl FnOnce(mixtape_core::Agent) -> MixtapeRouter) {}
fn _accepts_agent_arc(_: impl FnOnce(Arc<mixtape_core::Agent>) -> MixtapeRouter) {}
_accepts_agent_owned(MixtapeRouter::new);
_accepts_agent_arc(MixtapeRouter::from_arc);
}
#[cfg(feature = "agui")]
#[test]
fn test_router_builder_fluent_api() {
use crate::error::BuildError;
fn _test_chaining<F>(f: F)
where
F: FnOnce(MixtapeRouter) -> Result<axum::Router, BuildError>,
{
drop(f);
}
#[cfg(feature = "agui")]
_test_chaining(|builder| {
builder
.with_agui("/api/stream")
.interrupt_path("/api/interrupt")
.build()
});
_test_chaining(|builder| builder.with_agui("/api").build());
}
#[cfg(feature = "agui")]
#[test]
fn test_router_into_variants() {
use crate::error::BuildError;
fn _returns_result(_: impl FnOnce(MixtapeRouter) -> Result<axum::Router, BuildError>) {}
_returns_result(|b| b.with_agui("/api").build());
_returns_result(|b| b.with_agui("/api").build_nested("/prefix"));
}
#[cfg(feature = "agui")]
#[test]
fn test_router_path_types() {
fn _test_with_agui<S: Into<String>>(path: S) {
drop(path.into());
}
_test_with_agui("/api/stream");
_test_with_agui(String::from("/api/stream"));
_test_with_agui("api/stream"); }
#[cfg(feature = "agui")]
#[test]
fn test_router_builder_consumes_self() {
fn _consume_builder<F>(f: F)
where
F: FnOnce(MixtapeRouter),
{
drop(f);
}
_consume_builder(|router| {
let _app = router.with_agui("/api").build();
});
}
#[test]
fn test_app_state_construction() {
use crate::state::AppState;
fn _from_arc(agent: Arc<mixtape_core::Agent>) -> AppState {
AppState::from_arc(agent)
}
let _ = _from_arc;
}