use linera_base::{
data_types::{Amount, Timestamp},
identifiers::{ApplicationId, ChainId},
};
use linera_views::context::MemoryContext;
use serde::Serialize;
const ERROR_MESSAGE: &str =
"The mock API is only available for unit tests running inside a WebAssembly virtual machine. \
Please check that the unit tests are executed with `linera project test` or with \
`cargo test --target wasm32-unknown-unknown`. \
Also ensure that the unit tests (or the module containing them) has a \
`#[cfg(target_arch = \"wasm32-unknown-unknown\")]` attribute so that they don't get compiled \
in for the integration tests";
pub fn mock_chain_id(_chain_id: impl Into<Option<ChainId>>) {
unreachable!("{ERROR_MESSAGE}");
}
pub fn mock_application_id(_application_id: impl Into<Option<ApplicationId>>) {
unreachable!("{ERROR_MESSAGE}");
}
pub fn mock_application_parameters(_application_parameters: &impl Serialize) {
unreachable!("{ERROR_MESSAGE}");
}
pub fn mock_chain_balance(_chain_balance: impl Into<Option<Amount>>) {
unreachable!("{ERROR_MESSAGE}");
}
pub fn mock_system_timestamp(_system_timestamp: impl Into<Option<Timestamp>>) {
unreachable!("{ERROR_MESSAGE}");
}
pub fn log_messages() -> Vec<(log::Level, String)> {
unreachable!("{ERROR_MESSAGE}");
}
pub fn mock_application_state(_state: impl Into<Option<Vec<u8>>>) {
unreachable!("{ERROR_MESSAGE}");
}
pub fn mock_key_value_store() -> MemoryContext<()> {
unreachable!("{ERROR_MESSAGE}");
}
pub fn mock_try_query_application<E>(
_handler: impl FnMut(ApplicationId, Vec<u8>) -> Result<Vec<u8>, E> + 'static,
) where
E: ToString + 'static,
{
unreachable!("{ERROR_MESSAGE}");
}