From da4a2736bc943dcb6cfbcc1a94bc83f9712a5b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Wo=C5=BAniak?= Date: Fri, 8 Nov 2024 16:39:34 +0100 Subject: [PATCH] test: Assert deserialized payload has proper value --- sylvia/tests/reply_dispatch.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sylvia/tests/reply_dispatch.rs b/sylvia/tests/reply_dispatch.rs index 4a7c61e6..ab4925ea 100644 --- a/sylvia/tests/reply_dispatch.rs +++ b/sylvia/tests/reply_dispatch.rs @@ -210,12 +210,16 @@ where &self, ctx: ReplyCtx, #[sv::data(raw, opt)] data: Option, - _instantiate_payload: InstantiatePayload, + instantiate_payload: InstantiatePayload, ) -> Result, ContractError> { self.last_reply .save(ctx.deps.storage, &REMOTE_INSTANTIATED_REPLY_ID)?; let init_data = parse_instantiate_response_data(&data.unwrap())?; let remote_addr = Addr::unchecked(init_data.contract_address); + assert_eq!( + &instantiate_payload.sender.to_string(), + "cosmwasm1fsgzj6t7udv8zhf6zj32mkqhcjcpv52yph5qsdcl0qt94jgdckqs2g053y" + ); self.remote .save(ctx.deps.storage, &Remote::new(remote_addr))?; @@ -252,10 +256,12 @@ where &self, ctx: ReplyCtx, _result: SubMsgResult, - _first_part_payload: u32, - _second_part_payload: String, + first_part_payload: u32, + second_part_payload: String, ) -> Result, ContractError> { self.last_reply.save(ctx.deps.storage, &ALWAYS_REPLY_ID)?; + assert_eq!(first_part_payload, 42_u32); + assert_eq!(second_part_payload, "Hello, world!".to_string()); Ok(Response::new()) } @@ -267,7 +273,7 @@ where to_address: remote_addr.as_ref().to_string(), amount: vec![], }); - let submsg = cosmos_msg.always(0, "payload".to_string())?; + let submsg = cosmos_msg.always(42_u32, "Hello, world!".to_string())?; Ok(Response::new().add_submessage(submsg)) } }