use crate::ClientBuilder;
use candid::CandidType;
use ic_canister_runtime::StubRuntime;
impl<R, C, P> ClientBuilder<R, C, P> {
pub fn with_stub_runtime(self) -> ClientBuilder<StubRuntime, C, P> {
self.with_runtime(|_runtime| StubRuntime::default())
}
pub fn with_stub_response<Out: CandidType>(
self,
stub_response: Out,
) -> ClientBuilder<StubRuntime, C, P> {
self.with_stub_runtime().add_stub_response(stub_response)
}
}
impl<C, P> ClientBuilder<StubRuntime, C, P> {
pub fn add_stub_response<Out: CandidType>(
self,
stub_response: Out,
) -> ClientBuilder<StubRuntime, C, P> {
self.with_runtime(|runtime| runtime.add_stub_response(stub_response))
}
}