Skip to content

Commit

Permalink
Add btc-finality integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauro Lacy committed Sep 18, 2024
1 parent 9af350c commit a7a03ad
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions contracts/btc-finality/tests/integration.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use cosmwasm_std::{ContractResult, Response};
use cosmwasm_vm::testing::{instantiate, mock_env, mock_info, mock_instance};

use btc_finality::msg::InstantiateMsg;

// wasm binary lite version
static WASM: &[u8] = include_bytes!("../../../artifacts/btc_finality.wasm");
/// Wasm size limit: https://github.com/CosmWasm/wasmd/blob/main/x/wasm/types/validation.go#L24-L25
const MAX_WASM_SIZE: usize = 800 * 1024; // 800 KB

const CREATOR: &str = "creator";

#[test]
fn wasm_size_limit_check() {
assert!(
WASM.len() < MAX_WASM_SIZE,
"BTC finality contract wasm binary is too large: {} (target: {})",
WASM.len(),
MAX_WASM_SIZE
);
}

#[test]
fn instantiate_works() {
let mut deps = mock_instance(WASM, &[]);

let msg = InstantiateMsg {
params: None,
admin: None,
};
let info = mock_info(CREATOR, &[]);
let res: ContractResult<Response> = instantiate(&mut deps, mock_env(), info, msg);
let msgs = res.unwrap().messages;
assert_eq!(0, msgs.len());
}

0 comments on commit a7a03ad

Please sign in to comment.