Crates.io | hdk_unit_testing |
lib.rs | hdk_unit_testing |
version | 0.1.4 |
source | src |
created_at | 2021-12-14 00:39:12.07427 |
updated_at | 2022-05-27 04:53:14.489784 |
description | Functions to help make mocking HDK native functions easier. Not complete, this is a work in progress |
homepage | |
repository | |
max_upload_size | |
id | 497486 |
size | 11,599 |
This crate provides a library of mocked hdk functions to help with unit testing your zome functions.
In your tests, instantiate a mutable MockHdkT
object and pass a mutable reference of this into the mocked hdk functions.
let mut mock_hdk = MockHdkT::new();
let mock_hdk_ref = &mut mock_hdk;
All mocked functions take mock_hdk_ref
as an input as well as the expected input and output of the called hdk function.
use hdk_unit_testing::mock_hdk::*;
mock_create(
mock_hdk_ref,
expected_input,
expected_output,
);
See an example usage in Acorn.