From 65e9d86e48e3fd182882ceb54b9b8b1ff475369d Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Nov 2026 22:47:30 +0000 Subject: store: a test per attack row marked unit Each row of `docs/store.md`, Attacks, marked unit has its test, `store_attack_`: where it is judged (`access::holding`, `access::token`), where the store held in memory meets it (`federation::store::memory`), and where a node reads its store from its document (`federation::held`). Tests that checked a row already take its name; a check reads the doc's rows and fails on a unit row without its test, but for rows 21 and 22, which the remakes bring. --- src/document/events.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/document/events.rs') diff --git a/src/document/events.rs b/src/document/events.rs index 5fce55d..ab8675b 100644 --- a/src/document/events.rs +++ b/src/document/events.rs @@ -132,6 +132,22 @@ pub(crate) fn is_genesis(change: &Change, fold: &str, id: &Id) -> bool { root.is_some_and(|root| genesis(fold, &root).hash() == change.hash()) } +/// `events`, each at its ID, put into `doc` by one change. +#[cfg(test)] +pub(crate) fn put(doc: &mut Document, events: &[&[u8]]) { + super::testing::change(doc, |doc| { + for bytes in events { + store::write_val_path( + doc, + &event(&Id::of(bytes)), + &Val::Scalar(ScalarValue::Bytes(bytes.to_vec())), + store::Writing::sticky(TimestampFormat::default()), + ) + .expect("an event written"); + } + }); +} + #[cfg(test)] mod tests { use super::*; -- cgit v1.3.1