Skip to content

Commit b1d89ac

Browse files
committed
Add test for store_code without persisting
1 parent ce7d867 commit b1d89ac

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
@@ -706,6 +706,18 @@ mod tests {
706706
cache.store_code(CONTRACT, true, true).unwrap();
707707
}
708708

709+
#[test]
710+
fn store_code_without_persist_works() {
711+
let cache: Cache<MockApi, MockStorage, MockQuerier> =
712+
unsafe { Cache::new(make_testing_options()).unwrap() };
713+
let checksum = cache.store_code(CONTRACT, true, false).unwrap();
714+
715+
assert!(
716+
cache.load_wasm(&checksum).is_err(),
717+
"wasm file should not be saved to disk"
718+
);
719+
}
720+
709721
#[test]
710722
// This property is required when the same bytecode is uploaded multiple times
711723
fn store_code_allows_saving_multiple_times() {

0 commit comments

Comments
 (0)