Skip to main content

Crate durable_lambda_testing

Crate durable_lambda_testing 

Source
Expand description

Testing utilities for durable Lambda handlers.

This crate provides MockDurableContext for writing tests without AWS credentials. Pre-load step results and verify handler logic with deterministic, in-memory data.

§Quick Start

use durable_lambda_testing::prelude::*;

#[tokio::test]
async fn test_my_handler() {
    let (mut ctx, calls, _ops) = MockDurableContext::new()
        .with_step_result("validate", r#"true"#)
        .build()
        .await;

    let result: Result<bool, String> = ctx.step("validate", || async {
        panic!("not executed during replay");
    }).await.unwrap();

    assert!(result.unwrap());
    assert_no_checkpoints(&calls).await;
}

Re-exports§

pub use mock_backend::BatchCallCounter;
pub use mock_backend::CheckpointCall;
pub use mock_backend::CheckpointRecorder;
pub use mock_backend::MockBackend;
pub use mock_backend::OperationRecord;
pub use mock_backend::OperationRecorder;
pub use mock_context::MockDurableContext;

Modules§

assertions
Test assertion helpers for durable Lambda testing.
mock_backend
MockBackend — implements DurableBackend without AWS dependency.
mock_context
MockDurableContext — pre-loaded step results for local testing.
prelude
User-facing test re-exports for durable Lambda testing.