| Crates.io | blueprint-tangle-testing-utils |
| lib.rs | blueprint-tangle-testing-utils |
| version | 0.1.0-alpha.19 |
| created_at | 2025-04-09 18:49:28.212021+00 |
| updated_at | 2025-08-21 09:49:34.670784+00 |
| description | Tangle-specific testing utilities for Tangle Blueprints |
| homepage | https://tangle.tools |
| repository | https://github.com/tangle-network/blueprint |
| max_upload_size | |
| id | 1627178 |
| size | 656,285 |
A lightweight testing framework for Tangle blueprints that provides a complete test environment with minimal setup.
The framework consists of three main components:
The main test harness that manages the complete test infrastructure. It handles:
The test environment implementation that manages blueprint runners and event handlers. It's used internally by the harness to:
Your blueprint-specific context (e.g. MyContext) that holds the state needed by your event handlers.
#[tokio::test]
async fn test_my_blueprint() -> Result<()> {
// Initialize test harness (node, keys, deployment)
let harness = TangleTestHarness::setup().await?;
// Create your blueprint context
let blueprint_ctx = MyContext {
env: harness.env.clone(),
call_id: None,
};
// Initialize your event handler
let handler = MyEventHandler::new(&harness.env, blueprint_ctx).await?;
// Setup service and run test
let (_blueprint_id, service_id) = harness.setup_service(vec![handler]).await?;
// Execute jobs and verify results
let results = harness
.execute_job(
service_id,
JOB_ID,
inputs,
expected_outputs,
)
.await?;
}