Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leobragaz committed Nov 11, 2020
1 parent 54f5e16 commit 7290d95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,12 @@ const bonsaiCW = (client: SigningCosmWasmClient) : BonsaiContract => {
return r.data
}

const upload = async (): Promise<number> => {
const upload = async (metaSource: string, builderSource: string, contractSource: string): Promise<number> => {
const meta = {
source: "https://github.com/bragaz/wasm-test-contract/tree/v0.1.1",
builder: "cosmwasm/rust-optimizer:0.10.4"
source: metaSource,
builder: builderSource
};
const sourceUrl = "https://github.com/bragaz/wasm-test-contract/releases/download/v0.1.1/my_first_contract.wasm";
const sourceUrl = contractSource;
const wasm = await downloadWasm(sourceUrl);
const result = await client.upload(wasm, meta);
return result.codeId;
Expand Down
6 changes: 4 additions & 2 deletions src/contract_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ fn setup_test<S: Storage, A: Api, Q: Querier>(
price: bonsai_price,
number: bonsai_number,
};
init(deps, env.clone(), init_msg).unwrap();
let sender_addr = HumanAddr::from("addr0001");
init(deps, env.clone(), mock_info(&sender_addr, &[]), init_msg).unwrap();
}

// return a random bonsai id
Expand All @@ -69,8 +70,9 @@ fn test_init() {
price: coin(20, "bonsai"),
number: 20,
};
let sender_addr = HumanAddr::from("addr0001");
let env = mock_env_height(100);
let res = init(&mut deps, env, init_msg).unwrap();
let res = init(&mut deps, env, mock_info(&sender_addr, &[]), init_msg).unwrap();
assert_eq!(0, res.messages.len());

let exp_log = vec![attr("action", "grown_bonsais")];
Expand Down

0 comments on commit 7290d95

Please sign in to comment.