pub fn scripted_feed() -> (ScriptedFeed, FeedScript)Expand description
A scripted feed and its handle.
ยงExamples
use spate_core::feed::{Feed, FeedErrorKind, Unit};
let (feed, script) = spate_test::scripted_feed();
let first = script.deliver(Unit::new("day-1", b"2026-10-01".to_vec()));
let held = feed.receive(8).unwrap();
assert_eq!(held[0].receipt, first);
// The queue gives the unit to the reader again under a new receipt.
let second = script.redeliver(first);
let again = feed.receive(8).unwrap();
assert_eq!((again[0].receipt, again[0].deliveries), (second, 2));
// The first receipt has lapsed; the second acknowledges the unit.
let lapsed = feed.acknowledge(first).unwrap_err();
assert_eq!(lapsed.kind, FeedErrorKind::Gone);
feed.acknowledge(second).unwrap();
assert_eq!(script.acknowledged(), vec![second]);
assert_eq!(script.gone(), vec![first]);