-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Description
Hello Team,
It is impossible to Mock or create a Fake of the SimpleCacheClient (at least for me).
The client is initialised in this way:
let credential_provider =
CredentialProviderBuilder::from_environment_variable("MOMENTO_AUTH_TOKEN".to_string())
.build()?;
let cache_client =
SimpleCacheClientBuilder::new(credential_provider, Duration::from_secs(500))?
.build();
When writing code, you should be able to Mock the client or replace it.
If you create a trait with https://crates.io/crates/async-trait, it is possible to replace it or Mock it with a library like https://crates.io/crates/mockall.
With this, the code is testable if you write integration tests that are pretty expensive to run each time.
Thanks,
Reactions are currently unavailable