test_map!() { /* proc-macro */ }Expand description
Test helper macro that transforms a handler call to use the __impl_ testable function.
By default, #[substreams::handlers::map] generates a testable __impl_<name> function
alongside the WASM export. This macro provides a convenient way to call the testable
function in tests.
§Example
ⓘ
use substreams::test_map;
#[substreams::handlers::map]
fn map_transfers(blk: eth::Block) -> Result<Events, Error> {
// handler logic
}
#[test]
fn test_map_transfers() {
let blk = eth::Block::default();
let result = test_map!(map_transfers(blk));
assert!(result.is_ok());
}The macro transforms test_map!(map_transfers(blk)) into __impl_map_transfers(blk).