diff --git a/crates/thing-core/tests/resolve.rs b/crates/thing-core/tests/resolve.rs index 1147bb5..5e12544 100644 --- a/crates/thing-core/tests/resolve.rs +++ b/crates/thing-core/tests/resolve.rs @@ -266,7 +266,7 @@ fn an_unresolved_use_is_a_placeholder_and_a_read() { fn a_refused_composition_is_not_absence() { big(|| { let mut state = MemState::new(); - let bytes = rmp_serde::to_vec(&surface(boxed("root", vec![]), &[])).unwrap(); + let bytes = store::payload(&surface(boxed("root", vec![]), &[])).unwrap(); state.put_raw(comp_address("c"), bytes); let document = surface(boxed("root", vec![use_of("u", "c", vec![])]), &[]); let resolution = run(&document, &state); @@ -285,7 +285,7 @@ fn the_composition_record_must_be_the_one_the_use_names() { let other = composition("other", &[], boxed("c-root", vec![])); for wrong in [v2, other] { let mut state = MemState::new(); - state.put_raw(comp_address("c"), rmp_serde::to_vec(&wrong).unwrap()); + state.put_raw(comp_address("c"), store::payload(&wrong).unwrap()); let resolution = run(&surface(boxed("root", vec![use_of("u", "c", vec![])]), &[]), &state); only(&resolution, Code::CompositionInvalid, Some("u"), "differs"); } diff --git a/crates/thing-testkit/src/store.rs b/crates/thing-testkit/src/store.rs index 87811a6..5f20791 100644 --- a/crates/thing-testkit/src/store.rs +++ b/crates/thing-testkit/src/store.rs @@ -60,3 +60,8 @@ pub fn bytes(fill: impl FnOnce(&mut CultCache)) -> Vec { let _ = std::fs::remove_dir_all(&work); bytes } + +/// The payload the contract writes for `value`, as a store would hold it. +pub fn payload(value: &T) -> Vec { + memory().prepare_entry("payload", value).unwrap().0.payload +}