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 Dec 11, 2024
1 parent a1ea255 commit c8154ed
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 @@ -706,6 +706,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 c8154ed

Please sign in to comment.