Testing
Testing an ADO is similar to testing any standard CosmWasm contract. We will take a look at one test and note some minor differences:
fn test_instantiate_works() {
let mut deps = mock_dependencies_custom(&[]);
let info = mock_info(OWNER, &[]);
let max_voting_period = Duration::Time(1234567);
// No voters fails
let instantiate_msg = InstantiateMsg {
kernel_address: MOCK_KERNEL_CONTRACT.to_string(),
owner: None,
voters: vec![],
threshold: Threshold::ThresholdQuorum {
threshold: Decimal::zero(),
quorum: Decimal::percent(1),
},
max_voting_period,
};
/// the rest of the test is the same in both versions
Here we use the
mock_dependencies_custom
instead ofmock_dependencies
, which automatically assigns a kernel address (MOCK_KERNEL_CONTRACT
).The ADO
InstantiateMsg
includeskernel_address
andowner
fields.
The rest of the test logic is the same.
Further Testing
As mentioned before, we also provide custom mock structs for testing. You can check any of our published ADOs testing from our core repo to see how these structs can be used to conduct testing.
Last updated
Was this helpful?