diff --git a/packages/vm/src/cache.rs b/packages/vm/src/cache.rs index 4aa21cbf1..dde318d90 100644 --- a/packages/vm/src/cache.rs +++ b/packages/vm/src/cache.rs @@ -651,6 +651,18 @@ mod tests { cache.store_code(CONTRACT, true, true).unwrap(); } + #[test] + fn store_code_without_persist_works() { + let cache: Cache = + unsafe { Cache::new(make_testing_options()).unwrap() }; + let checksum = cache.store_code(CONTRACT, true, false).unwrap(); + + assert!( + cache.load_wasm(&checksum).is_err(), + "wasm file should not be saved to disk" + ); + } + #[test] // This property is required when the same bytecode is uploaded multiple times fn store_code_allows_saving_multiple_times() {