Why it needs tests: The Id struct has parsing logic (Id::new), and CacheStore has key generation logic (build_key). It also manages serialization and file persistence.
How to test it:
Id and build_key can be tested purely.
- The
CacheStore methods (get, set, remove) can be unit tested, but you would likely want to make a small refactor to allow passing a custom temporary path for the database during tests so it doesn't overwrite your actual cache or depend on the OS directory during cargo test.
Why it needs tests: The
Idstruct has parsing logic (Id::new), andCacheStorehas key generation logic (build_key). It also manages serialization and file persistence.How to test it:
Idandbuild_keycan be tested purely.CacheStoremethods (get,set,remove) can be unit tested, but you would likely want to make a small refactor to allow passing a custom temporary path for the database during tests so it doesn't overwrite your actual cache or depend on the OS directory duringcargo test.