How to check balances in my Rust unit tests?

I know how to set user token balances in unit tests:

    let info = mock_info(
      "user1",
      &[Coin {
        denom: "uscrt".to_owned(),
        amount: Uint128::new(100u128),
      }],
    );

But after calling my secret contract, how can I check the new user balance and the new contract balance in my Rust unit tests?

Is this info in your contract state? If so make a query function to use the info

during unit tests like the following:

    let info = mock_info(
      "user1",
      &[Coin {
        denom: "uscrt".to_owned(),
        amount: Uint128::new(123),
      }],
    );
    let msg = ExecuteMsg::Deposit {};
    let _res = execute(deps.as_mut(), mock_env(), info.clone(), msg).unwrap();

Would all those coins in the info be transferred to the contract automatically?
I was trying to test and see such behaviors. Thanks

No, you would need create assert_eq! statement to run your test. (cargo test) Based on your intuitive expectations it might be better to upload the contract to local or testnet and test it that way. That’s how I like to do it

#[cfg(test)]
mod tests {
    use super::*;
    use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info};
    use cosmwasm_std::{Coin, Uint128};

    #[test]
    fn test_deposit() {
        let mut deps = mock_dependencies();
        let info = mock_info(
            "user1",
            &[Coin {
                denom: "uscrt".to_string(),
                amount: Uint128::new(123),
            }],
        );
        let msg = ExecuteMsg::Deposit {};

        let res = execute(deps.as_mut(), mock_env(), info.clone(), msg).unwrap();

        // Assert expected outcomes
        assert_eq!(res.messages.len(), 0); // Example: No messages emitted
        // Add more assertions based on contract logic, e.g., storage updates
        // let balance = query_balance(deps.as_ref(), info.sender).unwrap();
        // assert_eq!(balance, Uint128::new(123));
    }
}