diff --git a/crates/mind-body/src/persona/drain_tests.rs b/crates/mind-body/src/persona/drain_tests.rs index 274eab1..bf65423 100644 --- a/crates/mind-body/src/persona/drain_tests.rs +++ b/crates/mind-body/src/persona/drain_tests.rs @@ -18,6 +18,8 @@ use crate::testkit::at; const META: &str = "@meta:gamecult.org"; const LIBBY: &str = "@libby:gamecult.org"; +const ANN: &str = "@ann:gamecult.org"; +const BO: &str = "@bo:gamecult.org"; const BASE_MS: u64 = 1_795_867_200_000; fn room(n: u64) -> String { @@ -218,9 +220,9 @@ impl Rig { } } -/// Three direct messages from the operator: every line wakes her, in three rooms. +/// Three direct messages, from the operator and two members: every line wakes her, in three rooms. fn three_rooms() -> Rig { - Rig::new(vec![line(1, &room(1), META, "morning, are you there"), line(2, &room(2), META, "evening, a question for you"), line(3, &room(3), META, "night, one more thing")]) + Rig::new(vec![line(1, &room(1), META, "morning, are you there"), line(2, &room(2), ANN, "evening, a question for you"), line(3, &room(3), BO, "night, one more thing")]) } #[test] @@ -312,12 +314,14 @@ fn t_p1_strike_then_set_aside() { /// A line set aside is acked past before the wake, so the wake reads its room without it: the later line of the room is answered in the same start. #[test] fn t_p1_a_set_aside_line_is_acked_before_the_wake_reads_the_room() { - let rig = Rig::new(vec![line(1, &room(1), META, "POISON in the first line"), line(2, &room(1), META, "a fine second line")]); - rig.run(poisoned("POISON", REFUSED)); - rig.run(poisoned("POISON", REFUSED)); - assert_eq!(rig.run(poisoned("POISON", REFUSED)), Outcome::Drained { wakes: 1, acked_through: Some(2) }); + let rig = Rig::new(vec![line(1, &room(1), META, "a line the model refuses"), line(2, &room(1), META, "a fine second line")]); + rig.run(failing(REFUSED)); + rig.run(failing(REFUSED)); + let tally = Tally::default(); + assert_eq!(rig.run(tally.clone()), Outcome::Drained { wakes: 1, acked_through: Some(2) }); assert_eq!(rig.acks(), [1, 2], "past the set-aside line first, then the wake's"); assert_eq!(rig.records().last().unwrap()["status"], "completed"); + assert!(tally.0.borrow()[1].contains("a fine second line")); } #[test] diff --git a/crates/mind-body/src/projection.rs b/crates/mind-body/src/projection.rs index 98b4a7e..7aec9c5 100644 --- a/crates/mind-body/src/projection.rs +++ b/crates/mind-body/src/projection.rs @@ -349,7 +349,7 @@ fn packet_json(packet: &Packet) -> Value { "arrival": packet.arrival, "speaking": packet.speaking, "heard": packet.heard, - "elsewhere_shown": packet.elsewhere_shown, + "shown_from_other_rooms": packet.elsewhere_shown, }) } diff --git a/crates/mind-body/src/projection/wake.rs b/crates/mind-body/src/projection/wake.rs index 07aa2f3..601d26b 100644 --- a/crates/mind-body/src/projection/wake.rs +++ b/crates/mind-body/src/projection/wake.rs @@ -50,7 +50,7 @@ pub(crate) fn wake(organs: &Organs, request: &Request, now: DateTime) -> Re prose: persona["prose"].as_str().map(str::to_owned), usage: json!({ "projector": render["usage"], "persona": persona["usage"] }), failed, - elsewhere_shown: report["packet"]["elsewhere_shown"].as_array().into_iter().flatten().filter_map(Value::as_str).map(str::to_owned).collect(), + elsewhere_shown: report["packet"]["shown_from_other_rooms"].as_array().into_iter().flatten().filter_map(Value::as_str).map(str::to_owned).collect(), report, }) }