Skip to content

Commit

Permalink
chore: improve test coverage for ibc connection
Browse files Browse the repository at this point in the history
  • Loading branch information
bishalbikram committed Mar 10, 2024
1 parent 3767742 commit 262bde0
Show file tree
Hide file tree
Showing 3 changed files with 307 additions and 137 deletions.
36 changes: 36 additions & 0 deletions contracts/cosmwasm-vm/cw-ibc-core/tests/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,16 @@ impl TestContext {
self.save_consensus_state(storage, self.client_state.clone().unwrap().latest_height);
}

pub fn init_connection_delay(
&mut self,
storage: &mut dyn Storage,
contract: &CwIbcCoreContext,
) {
contract
.store_last_processed_on(storage, &self.env, &self.client_id)
.unwrap();
}

pub fn save_next_sequence_send(&self, storage: &mut dyn Storage, contract: &CwIbcCoreContext) {
if let Some(packet) = self.packet.clone() {
contract
Expand Down Expand Up @@ -1081,6 +1091,32 @@ impl TestContext {
}
}

pub fn save_connection_to_client(
&self,
storage: &mut dyn Storage,
contract: &CwIbcCoreContext,
) {
contract
.store_connection_to_client(storage, &self.client_id, &self.connection_id)
.unwrap();
}

pub fn save_client_commitment(
&self,
storage: &mut dyn Storage,
contract: &CwIbcCoreContext,
client_state_hash: &Vec<u8>,
) {
contract
.store_client_commitment(
storage,
&self.env,
&self.client_id,
client_state_hash.clone(),
)
.unwrap();
}

pub fn save_channel_end(&self, storage: &mut dyn Storage, contract: &CwIbcCoreContext) {
if let Some(channel_end) = self.channel_end.clone() {
contract
Expand Down
Loading

0 comments on commit 262bde0

Please sign in to comment.