Skip to content

Commit

Permalink
assert USER balance
Browse files Browse the repository at this point in the history
add MockAPi import

add denom to query_balance

refactor mock actors and add assert for user balance
  • Loading branch information
Perelyn-sama committed Apr 26, 2024
1 parent 98b5358 commit b5de71e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
mod tests {
use crate::helpers::CwTemplateContract;
use crate::msg::InstantiateMsg;
use cosmwasm_std::testing::MockApi;
use cosmwasm_std::{Addr, Coin, Empty, Uint128};
use cw_multi_test::{App, AppBuilder, Contract, ContractWrapper, Executor};

Expand All @@ -24,7 +25,7 @@ mod tests {
.bank
.init_balance(
storage,
&Addr::unchecked(USER),
&MockApi::default().addr_make(USER),
vec![Coin {
denom: NATIVE_DENOM.to_string(),
amount: Uint128::new(1),
Expand All @@ -38,6 +39,12 @@ mod tests {
let mut app = mock_app();
let cw_template_id = app.store_code(contract_template());

let user = app.api().addr_make(USER);
assert_eq!(
app.wrap().query_balance(user, NATIVE_DENOM).unwrap().amount,
Uint128::new(1)
);

let msg = InstantiateMsg { count: 1i32 };
let cw_template_contract_addr = app
.instantiate_contract(
Expand Down

0 comments on commit b5de71e

Please sign in to comment.