From e7f5a9c03cab83294a1c19ca5ba64673e5a097cb Mon Sep 17 00:00:00 2001 From: Kishan Dhakan Date: Fri, 5 Jan 2024 01:04:55 +0530 Subject: [PATCH] chore: add asserts --- .../src/testing/query_spot_market_test.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/contracts/injective-cosmwasm-mock/src/testing/query_spot_market_test.rs b/contracts/injective-cosmwasm-mock/src/testing/query_spot_market_test.rs index 251d2c36..a56d46c2 100644 --- a/contracts/injective-cosmwasm-mock/src/testing/query_spot_market_test.rs +++ b/contracts/injective-cosmwasm-mock/src/testing/query_spot_market_test.rs @@ -40,10 +40,11 @@ fn test_instantiation() { .unwrap() .data .address; + assert!(contract_address.len() > 0, "Contract address is empty"); // Execute contract let buyer_subaccount_id = checked_address_to_subaccount_id(&Addr::unchecked(buyer.address()), 1u32); - let _res = wasm + let res = wasm .execute( &contract_address, &ExecuteMsg::TestDepositMsg { @@ -52,8 +53,8 @@ fn test_instantiation() { }, &[Coin::new(100, "usdt")], &buyer, - ) - .unwrap(); + ); + assert!(res.is_ok(), "Execution failed with error: {:?}", res.unwrap_err()); // Instantiate spot market let ticker = "INJ/USDT".to_string(); @@ -83,7 +84,8 @@ fn test_instantiation() { let spot_market_id = market.market_id.to_string(); // Query - let market_id = MarketId::new(spot_market_id).unwrap(); + let market_id = MarketId::new(spot_market_id.clone()).unwrap(); let query_msg = QueryMsg::TestSpotMarketQuery { market_id }; - let _res: SpotMarketResponse = wasm.query(&contract_address, &query_msg).unwrap(); + let res: SpotMarketResponse = wasm.query(&contract_address, &query_msg).unwrap(); + assert_eq!(res.market.clone().unwrap().market_id.as_str(), spot_market_id.clone()); }