diff --git a/packages/multi-test/src/app.rs b/packages/multi-test/src/app.rs index 0f5f1a242..611d231eb 100644 --- a/packages/multi-test/src/app.rs +++ b/packages/multi-test/src/app.rs @@ -732,12 +732,8 @@ mod test { // validate the events written in the reply blob...should just be bank transfer let reply = res.result.unwrap(); assert_eq!(1, reply.events.len()); - // Note: this shows we must make the helpers more generic - let app_res = AppResponse { - events: reply.events, - data: reply.data, - }; - app_res.assert_event(&Event::new("transfer").add_attribute("amount", "7eth")); + AppResponse::from(reply) + .assert_event(&Event::new("transfer").add_attribute("amount", "7eth")); // reflect sends 300 btc, failure, but error caught by submessage (so shows success) let msg = SubMsg::reply_always( diff --git a/packages/multi-test/src/executor.rs b/packages/multi-test/src/executor.rs index 45d8fee2a..c56c5cf43 100644 --- a/packages/multi-test/src/executor.rs +++ b/packages/multi-test/src/executor.rs @@ -1,7 +1,10 @@ use std::fmt; use crate::parse_contract_addr; -use cosmwasm_std::{to_binary, Addr, Attribute, BankMsg, Binary, Coin, CosmosMsg, Event, WasmMsg}; +use cosmwasm_std::{ + to_binary, Addr, Attribute, BankMsg, Binary, Coin, CosmosMsg, Event, SubMsgExecutionResponse, + WasmMsg, +}; use schemars::JsonSchema; use serde::Serialize; @@ -47,6 +50,17 @@ impl AppResponse { } } +/// They have the same shape, SubMsgExecutionResponse is what is returned in reply. +/// This is just to make some test cases easier. +impl From for AppResponse { + fn from(reply: SubMsgExecutionResponse) -> Self { + AppResponse { + data: reply.data, + events: reply.events, + } + } +} + pub trait Executor where C: Clone + fmt::Debug + PartialEq + JsonSchema + 'static,