Skip to main content

durable_lambda_testing/
lib.rs

1//! Testing utilities for durable Lambda handlers.
2//!
3//! This crate provides [`MockDurableContext`](mock_context::MockDurableContext) for
4//! writing tests without AWS credentials. Pre-load step results and verify
5//! handler logic with deterministic, in-memory data.
6//!
7//! # Quick Start
8//!
9//! ```no_run
10//! use durable_lambda_testing::prelude::*;
11//!
12//! #[tokio::test]
13//! async fn test_my_handler() {
14//!     let (mut ctx, calls, _ops) = MockDurableContext::new()
15//!         .with_step_result("validate", r#"true"#)
16//!         .build()
17//!         .await;
18//!
19//!     let result: Result<bool, String> = ctx.step("validate", || async {
20//!         panic!("not executed during replay");
21//!     }).await.unwrap();
22//!
23//!     assert!(result.unwrap());
24//!     assert_no_checkpoints(&calls).await;
25//! }
26//! ```
27
28pub mod assertions;
29pub mod mock_backend;
30pub mod mock_context;
31pub mod prelude;
32
33pub use mock_backend::{
34    BatchCallCounter, CheckpointCall, CheckpointRecorder, MockBackend, OperationRecord,
35    OperationRecorder,
36};
37pub use mock_context::MockDurableContext;