#[test]
fn test_minimal_router_without_config() {
use allframe_core::router::Router;
let mut router = Router::new();
router.register("test", || async { "Hello".to_string() });
assert_eq!(router.handlers_count(), 1);
}
#[test]
#[cfg(feature = "router")]
fn test_router_with_config() {
use allframe_core::router::{Router, RouterConfig};
let config_toml = r#"
[server]
protocols = ["rest"]
"#;
let config = RouterConfig::from_toml(config_toml).unwrap();
let router = Router::with_config(config);
assert!(router.has_adapter("rest"));
}
#[test]
#[cfg(feature = "router-graphql")]
fn test_graphql_production_adapter() {
use allframe_core::router::GraphQLProductionAdapter;
let adapter = GraphQLProductionAdapter::new("/graphql");
let schema = adapter.graphiql_source();
assert!(schema.contains("GraphiQL"));
}
#[test]
#[cfg(feature = "router-grpc")]
fn test_grpc_production_adapter() {
use allframe_core::router::{GrpcProductionAdapter, ProtocolAdapter};
let adapter = GrpcProductionAdapter::new("test-service");
assert_eq!(adapter.name(), "grpc-production");
}
#[test]
#[cfg(all(feature = "router-graphql", feature = "router-grpc"))]
fn test_full_router_features() {
use allframe_core::router::{GraphQLProductionAdapter, GrpcProductionAdapter};
let _graphql = GraphQLProductionAdapter::new("/graphql");
let _grpc = GrpcProductionAdapter::new("test-service");
assert!(true);
}
#[test]
fn test_mvp_adapters_always_available() {
use allframe_core::router::{GraphQLAdapter, GrpcAdapter, RestAdapter};
let _rest = RestAdapter::new();
let _graphql = GraphQLAdapter::new();
let _grpc = GrpcAdapter::new();
assert!(true);
}
#[test]
#[cfg(not(feature = "router"))]
fn test_config_not_available_without_router_feature() {
use allframe_core::router::Router;
let _router = Router::new();
assert!(true);
}
#[test]
#[cfg(all(not(feature = "router-graphql"), not(feature = "router-grpc")))]
fn test_production_adapters_not_available() {
use allframe_core::router::Router;
let _router = Router::new();
assert!(true);
}
#[test]
fn test_baseline_compiles() {
assert!(true);
}
#[test]
fn test_feature_flag_benefits_documented() {
assert!(true);
}