Skip to content

Commit 5c05f88

Browse files
committed
Add test for store_code without persisting
1 parent 9b9971e commit 5c05f88

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/vm/src/cache.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,18 @@ mod tests {
672672
cache.store_code(CONTRACT, true, true).unwrap();
673673
}
674674

675+
#[test]
676+
fn store_code_without_persist_works() {
677+
let cache: Cache<MockApi, MockStorage, MockQuerier> =
678+
unsafe { Cache::new(make_testing_options()).unwrap() };
679+
let checksum = cache.store_code(CONTRACT, true, false).unwrap();
680+
681+
assert!(
682+
cache.load_wasm(&checksum).is_err(),
683+
"wasm file should not be saved to disk"
684+
);
685+
}
686+
675687
#[test]
676688
// This property is required when the same bytecode is uploaded multiple times
677689
fn store_code_allows_saving_multiple_times() {

0 commit comments

Comments
 (0)