Skip to content

Commit

Permalink
Add test for store_code without persisting
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed Nov 25, 2024
1 parent 6fc6597 commit be33afd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/vm/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,18 @@ mod tests {
cache.store_code(CONTRACT, true, true).unwrap();
}

#[test]
fn store_code_without_persist_works() {
let cache: Cache<MockApi, MockStorage, MockQuerier> =
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() {
Expand Down

0 comments on commit be33afd

Please sign in to comment.