ibc-testkit 0.57.0

Maintained by `ibc-rs`, serves as a versatile library that provides essential abstractions and implementations, fulfilling a dual role of enabling rigorous integration testing for the `ibc-rs` implementation while also aiding host chains in addressing a broad spectrum of testing scenarios during their integrations with `ibc-rs`.
Documentation
pub mod applications;
pub mod clients;
pub mod core;
use alloc::fmt::Debug;

use ibc::core::handler::types::error::HandlerError;
use ibc::core::primitives::prelude::*;

use crate::testapp::ibc::core::types::DefaultIbcStore;
pub enum Expect {
    Success,
    Failure(Option<HandlerError>),
}

#[derive(Debug)]
pub struct Fixture<M: Debug> {
    pub ctx: DefaultIbcStore,
    pub msg: M,
}

impl<M: Debug> Fixture<M> {
    pub fn generate_error_msg(
        &self,
        expect: &Expect,
        process: &str,
        res: &Result<(), HandlerError>,
    ) -> String {
        let base_error = match expect {
            Expect::Success => "step failed!",
            Expect::Failure(_) => "step passed but was supposed to fail!",
        };
        format!(
            "{process} {base_error} /n {res:?} /n {:?} /n {:?}",
            &self.msg, &self.ctx
        )
    }
}