Expand description
GraphQL Operation Server Harness
A test harness for mocking GraphQL endpoints with predefined responses.
§Example
use graphql_operation_server_harness::prelude::*;
#[tokio::main]
async fn main() -> Result<(), HarnessError> {
let result = ScenarioBuilder::new()
.server(AsyncGraphQL::default())
.collector(DefaultCollector::new())
.operation(
Operation::query()
.with_field(
Field::new("users")
.with_handler(Handler::new(serde_json::json!({
"users": [{"id": 1, "name": "John"}]
})))
)
)
.build()
.execute()
.await?;
Ok(())
}Re-exports§
pub use error::HarnessError;
Modules§
Structs§
- Async
GraphQL - AsyncGraphQL-compatible server implementation
- Default
Collector - Default collector implementation using a thread-safe vector