Cotton code
344 lines · 23.8 KB · RustRaw
//! Chat's call rules: the line a call leaves, the header's buttons and the//! call screen. Every name is invented.use super::*;use crate::calling::machine::{step, Callee, Event};use crate::calling::wire::{RoomFrame, Started};use crate::messages::app::list::lines;const ROOM: &str = "0123456789abcdef0123456789abcdef";fn pic() -> Picture {    Picture { photo: None, initials: "AE".into(), tint: 3 }}fn facts(direction: &str, video: bool, outcome: &str, reason: &str, secs: i64, missed: bool) -> CallFacts {    CallFacts { room: ROOM.into(), direction: direction.into(), video, outcome: outcome.into(), reason: reason.into(), duration_s: secs, missed, group: false }}fn placed(video: bool) -> Call {    let (call, _) = step(&Call::idle(), Event::Dial { uuid: "U".into(), callees: vec![Callee { number: "+15550100001".into(), person: None, name: Some("Asha Example".into()) }], video, group: None }, 1_000);    let started = Started { room: ROOM.into(), credential: "c".into(), ice_servers: vec![], ttl: 60, ring_for: 45, mode: Default::default(), me: Some("caller".into()), group: None };    step(&call, Event::Started(started), 1_100).0}// RULE: a call's line says what happened from this side: an answered call its kind and length, a ring nobody here took// "Missed", one declined here "Declined", one this side gave up "Cancelled", and an unanswered placed call why.#[test]fn a_call_line_says_what_happened() {    let l = lines();    assert_eq!(line(&l, &facts("out", false, "answered", "hung_up", 192, false)), "Voice call · 3:12");    assert_eq!(line(&l, &facts("in", true, "answered", "remote_hung_up", 3729, false)), "Video call · 1:02:09");    assert_eq!(line(&l, &facts("in", true, "missed", "missed", 0, true)), "Missed video call");    assert_eq!(line(&l, &facts("in", false, "missed", "declined", 0, false)), "Declined voice call");    assert_eq!(line(&l, &facts("out", false, "cancelled", "cancelled", 0, false)), "Cancelled voice call");    assert_eq!(line(&l, &facts("out", false, "missed", "no_answer", 0, false)), "Voice call · No answer");    assert_eq!(line(&l, &facts("out", true, "missed", "busy", 0, false)), "Video call · Busy");    assert_eq!(line(&l, &facts("out", false, "failed", "failed", 0, false)), "Voice call · Couldn't connect");}// RULE: only a Cotton conversation with someone to ring offers calls, and never while it is a stranger's unanswered// request; a group's buttons ring the group. Voice first, then video.#[test]fn the_header_offers_calls_only_where_they_can_go() {    let l = lines();    let two = buttons(&l, true, false, false, 1).expect("a Cotton chat calls");    assert_eq!(two.iter().map(|b| (b.video, b.label.as_str())).collect::<Vec<_>>(), [(false, "Call"), (true, "Video call")]);    assert_eq!(buttons(&l, true, false, true, 3).unwrap()[0].label, "Group call");    assert!(buttons(&l, false, false, false, 1).is_none(), "an imported thread offers no call");    assert!(buttons(&l, true, true, false, 1).is_none(), "a request is answered first");    assert!(buttons(&l, true, false, true, 0).is_none(), "nobody left to ring");}// RULE: the call screen says the phase in words until the call is live, then hands the moment it went live for the// clock; the controls are mute, speaker, video, flip (camera on only) and end, lit as they stand.#[test]fn the_call_screen_says_the_call() {    let l = lines();    let ringing = placed(true);    let s = screen(&l, &ringing, "Asha Example", pic(), false, 1_200);    assert!(s.shown);    assert_eq!(s.status.as_deref(), Some("Ringing…"));    assert_eq!(s.controls.iter().map(|c| c.id.as_str()).collect::<Vec<_>>(), ["mute", "speaker", "video", "flip", "end"]);    assert!(s.camera && s.video && s.ring.is_none());    assert_eq!(s.bar.as_deref(), Some("Asha Example · tap to return"));    let (connecting, _) = step(&ringing, Event::Frame(RoomFrame::State { state: crate::calling::wire::RoomState::Connecting, at: None }), 2_000);    let (live, _) = step(&connecting, Event::Media(crate::calling::wire::MediaState::Connected), 3_000);    let s = screen(&l, &live, "Asha Example", pic(), true, 4_000);    assert_eq!((s.phase.as_str(), s.status.clone(), s.live_at), ("live", None, Some(3_000)));    assert!(s.controls.iter().any(|c| c.id == "speaker" && c.on));    let (muted, _) = step(&live, Event::Mute { audio: false, video: false }, 5_000);    let s = screen(&l, &muted, "Asha Example", pic(), false, 5_000);    assert_eq!(s.controls.iter().map(|c| (c.id.as_str(), c.label.as_str(), c.on)).collect::<Vec<_>>(), [("mute", "Unmute", true), ("speaker", "Speaker", false), ("video", "Camera", false), ("end", "End", false)]);    let (ended, _) = step(&muted, Event::HangUp, 6_000);    let s = screen(&l, &ended, "Asha Example", pic(), false, 6_500);    assert!(s.shown && s.controls.is_empty() && s.bar.is_none());    assert_eq!(s.status.as_deref(), Some("Call ended"));    assert!(!screen(&l, &ended, "Asha Example", pic(), false, 6_000 + ENDED_FOR_MS as i64).shown, "the ended screen goes after its time");}// RULE: a ring here offers Answer and Decline and no controls; its facts once it ends unanswered are a missed call.#[test]fn a_ring_offers_answer_and_decline() {    let l = lines();    let (ring, _) = step(&Call::idle(), Event::Incoming { room: ROOM.into(), video: false }, 1_000);    let s = screen(&l, &ring, "Asha Example", pic(), false, 1_000);    let r = s.ring.expect("a ring");    assert_eq!((r.title.as_str(), r.answer.as_str(), r.decline.as_str()), ("Cotton voice call", "Answer", "Decline"));    assert!(s.controls.is_empty() && s.bar.is_none());    let (missed, _) = step(&ring, Event::Stop { reason: crate::calling::wire::EndReason::Cancelled }, 2_000);    let f = CallFacts::of(&missed).expect("ended");    assert!(f.missed && f.incoming());    assert_eq!(line(&l, &f), "Missed voice call");}// RULE: with a Bluetooth device or headphones among the phone's routes, the speaker toggle becomes Audio, labelled with the route in use (a Bluetooth device by its own name), and the routes are offered; with the earpiece and loudspeaker alone it stays the toggle.#[test]fn a_headset_turns_the_speaker_into_a_route_choice() {    let l = lines();    let (ringing, _) = step(&placed(false), Event::Frame(RoomFrame::State { state: crate::calling::wire::RoomState::Connecting, at: None }), 2_000);    let (live, _) = step(&ringing, Event::Media(crate::calling::wire::MediaState::Connected), 3_000);    let route = |id: &str, kind: &str, name: Option<&str>| AudioRoute { id: id.into(), kind: kind.into(), name: name.map(str::to_string) };    let plain = [route("e", "phone", None), route("s", "speaker", None)];    let s = routed(&l, &live, "Asha Example", pic(), false, &plain, Some("e"), 4_000);    assert!(s.routes.is_empty() && s.controls.iter().any(|c| c.id == "speaker"));    let all = [route("e", "phone", None), route("s", "speaker", None), route("bt:1", "bluetooth", Some("Example Buds"))];    let s = routed(&l, &live, "Asha Example", pic(), false, &all, Some("bt:1"), 4_000);    let audio = s.controls.iter().find(|c| c.id == "audio").expect("the audio control");    assert_eq!((audio.label.as_str(), audio.on), ("Example Buds", true));    assert!(!s.controls.iter().any(|c| c.id == "speaker"));    assert_eq!(s.routes.iter().map(|r| (r.label.as_str(), r.on)).collect::<Vec<_>>(), [("Phone", false), ("Speaker", false), ("Example Buds", true)]);    // Nothing said back yet: the speaker flag picks the route in use.    let s = routed(&l, &live, "Asha Example", pic(), true, &all, None, 4_000);    assert_eq!(s.controls.iter().find(|c| c.id == "audio").map(|c| c.label.as_str()), Some("Speaker"));}// RULE: a voice call offers no Camera: the call machine turns no camera on in a voice call, and the button did nothing (two emulators, 21 Nov 2026).#[test]fn a_voice_call_offers_no_camera() {    let l = lines();    let s = screen(&l, &placed(false), "Asha Example", pic(), false, 1_200);    assert_eq!(s.controls.iter().map(|c| c.id.as_str()).collect::<Vec<_>>(), ["mute", "speaker", "end"]);    assert!(!s.camera);}// RULE: a call an export wrote as a line under the caller's name is a call's line, in the kit's words with the// export's own detail, its invisible direction marks gone; anything else is words someone wrote.#[test]fn an_imported_call_record_is_a_call_line() {    let l = lines();    assert_eq!(imported_line(&l, "\u{200e}Voice call, \u{200e}41 sec").as_deref(), Some("Voice call · 41 sec"));    assert_eq!(imported_line(&l, "Video call, 1 hr").as_deref(), Some("Video call · 1 hr"));    assert_eq!(imported_line(&l, "\u{200e}Missed voice call, \u{200e}Tap to call back").as_deref(), Some("Missed voice call"));    assert_eq!(imported_line(&l, "Missed group video call").as_deref(), Some("Missed video call"));    assert_eq!(imported_line(&l, "Voice call").as_deref(), Some("Voice call"));    assert_eq!(imported_line(&l, "Group voice call, No answer").as_deref(), Some("Voice call · No answer"));    for words in ["Voice call me later", "Can you video call?", "voice call, 41 sec\nsee you", "", "Call me"] {        assert_eq!(imported_line(&l, words), None, "{words:?}");    }}// ── group calls (23 Nov 2026) ─────────────────────────const GROUP: &str = "fedcba9876543210fedcba9876543210";fn member(id: &str, number: &str, state: &str, audio: bool, video: bool, speaking: bool) -> serde_json::Value {    serde_json::json!({ "id": id, "number": number, "state": state, "audio": audio, "video": video, "speaking": speaking })}/// A group's video call, live, this phone the caller, with three others: one talking, one muted, one still rung.fn group_live() -> Call {    let callees = ["+15550100001", "+15550100002", "+15550100003"].map(|n| Callee { number: n.into(), person: None, name: None }).to_vec();    let (call, _) = step(&Call::idle(), Event::Dial { uuid: "G".into(), callees, video: true, group: Some(GROUP.into()) }, 1_000);    let started = Started { room: ROOM.into(), credential: "c".into(), ice_servers: vec![], ttl: 60, ring_for: 45, mode: crate::calling::wire::Mode::Sfu, me: Some("caller".into()), group: Some(GROUP.into()) };    let (call, _) = step(&call, Event::Started(started), 1_100);    let roster = serde_json::from_value(serde_json::json!({ "t": "roster", "members": [        member("caller", "+15550100000", "joined", true, true, false),        member("m1", "+15550100001", "joined", true, true, true),        member("m2", "+15550100002", "joined", false, false, false),        member("m3", "+15550100003", "invited", false, false, false),    ] }))    .unwrap();    let (call, _) = step(&call, Event::Frame(roster), 1_200);    step(&call, Event::Frame(RoomFrame::State { state: crate::calling::wire::RoomState::Live, at: None }), 1_300).0}fn named(m: &crate::calling::wire::Member) -> (String, Picture) {    let name = match m.id.as_str() {        "m1" => "Asha Example",        "m2" => "Ravi Example",        "m3" => "Meera Example",        _ => "The Owner",    };    (name.into(), Picture { photo: None, initials: lay_initials(name), tint: 1 })}fn lay_initials(name: &str) -> String {    name.split_whitespace().filter_map(|w| w.chars().next()).collect()}// RULE: 2 stacked; 3 or 4 two by two; 5 or 6 two by three; 7 or 8 two by four; 9 three by three.#[test]fn the_grid_reads_well_from_two_to_nine() {    let shape = |n| { let g = grid(n); (g.columns, g.rows) };    assert_eq!([2, 3, 4, 5, 6, 7, 8, 9].map(shape), [(1, 2), (2, 2), (2, 2), (2, 3), (2, 3), (2, 4), (2, 4), (3, 3)]);}// RULE: a group call's screen draws a tile for each person in it or still rung, the others first and you last; who// talks, who is muted and whose camera is on; it says it is protected in transit, never end to end; the red button// leaves.#[test]fn a_group_calls_screen_draws_everyone_and_says_what_protects_it() {    let l = lines();    let call = group_live();    let s = group_screen(&l, &call, "Invented Family", pic(), false, &[], None, 1_400, &named);    assert!(s.group);    let tiles: Vec<(&str, bool, bool, bool, Option<&str>)> = s.tiles.iter().map(|t| (t.name.as_str(), t.speaking, t.muted, t.camera, t.state.as_deref())).collect();    assert_eq!(tiles, [        ("Asha Example", true, false, true, None),        ("Ravi Example", false, true, false, None),        ("Meera Example", false, false, false, Some("Ringing…")),        ("You", false, false, true, None),    ]);    assert!(s.tiles[3].you);    assert_eq!(s.grid, Some(Grid { columns: 2, rows: 2 }));    assert_eq!(s.privacy.as_deref(), Some("Protected in transit"));    let said = format!("{} {}", s.privacy.clone().unwrap_or_default(), s.privacy_detail.clone().unwrap_or_default()).to_lowercase();    assert!(!said.contains("end to end") || said.contains("not end to end"), "a group call is never called end to end: {said}");    assert_eq!(s.controls.last().map(|c| c.label.as_str()), Some("Leave"));    assert!(s.notes.is_none());}// RULE: someone leaving takes their tile away; a one-to-one call draws no tiles and says no privacy line.#[test]fn a_member_who_left_has_no_tile_and_a_one_to_one_has_none() {    let l = lines();    let call = group_live();    let left = serde_json::from_value(serde_json::json!({ "t": "member", "member": member("m2", "+15550100002", "left", false, false, false) })).unwrap();    let (call, _) = step(&call, Event::Frame(left), 1_500);    let s = group_screen(&l, &call, "Invented Family", pic(), false, &[], None, 1_600, &named);    assert_eq!(s.tiles.iter().map(|t| t.member.as_str()).collect::<Vec<_>>(), ["m1", "m3", "caller"]);    assert_eq!(s.grid, Some(Grid { columns: 2, rows: 2 }));    let one = group_screen(&l, &placed(false), "Asha Example", pic(), false, &[], None, 1_200, &named);    assert!(!one.group && one.tiles.is_empty() && one.privacy.is_none() && one.grid.is_none());}// RULE: while anyone takes notes every phone draws the mark naming them, and their tile says so.#[test]fn notes_are_marked_on_every_phone() {    let l = lines();    let taking = serde_json::from_value(serde_json::json!({ "t": "member", "member": { "id": "m1", "number": "+15550100001", "state": "joined", "audio": true, "video": true, "notes": true, "can": ["notes"] } })).unwrap();    let (call, _) = step(&group_live(), Event::Frame(taking), 1_500);    let s = group_screen(&l, &call, "Invented Family", pic(), false, &[], None, 1_600, &named);    let mark = s.notes.clone().expect("the mark");    assert_eq!((mark.line.as_str(), mark.mark, mark.by[0].member.as_str()), ("Asha Example is taking notes", true, "m1"));    assert!(s.tiles.iter().find(|t| t.member == "m1").is_some_and(|t| t.notes));    let mine = serde_json::from_value(serde_json::json!({ "t": "member", "member": { "id": "caller", "number": "+15550100000", "state": "joined", "audio": true, "video": true, "notes": true } })).unwrap();    let (call, _) = step(&call, Event::Frame(mine), 1_700);    let s = group_screen(&l, &call, "Invented Family", pic(), false, &[], None, 1_800, &named);    assert_eq!(s.notes.map(|m| m.line), Some("Asha Example, You are taking notes".to_string()));}// RULE: a group's call line names who started it, or says it was you.#[test]fn a_groups_call_line_says_who_started_it() {    let l = lines();    assert_eq!(group_started(&l, Some("Asha Example"), false), "Asha Example started a voice call");    assert_eq!(group_started(&l, None, true), "You started a video call");}// RULE: Take notes refused because someone cannot show the mark is said on the note-taker's screen, naming them; asking// again takes the words away. On a group call a joiner who cannot show it stops the notes, said by name.#[test]fn notes_refused_or_stopped_is_said_by_name() {    let l = lines();    let frame = |v: serde_json::Value| Event::Frame(serde_json::from_value(v).unwrap());    let (call, _) = step(&placed(false), frame(serde_json::json!({ "t": "state", "state": "connecting" })), 1_150);    let (call, _) = step(&call, Event::Media(crate::calling::wire::MediaState::Connected), 1_200);    let (call, _) = step(&call, frame(serde_json::json!({ "t": "notes", "refused": "cannot_show", "members": ["callee:x"] })), 1_300);    assert_eq!(screen(&l, &call, "Asha Example", pic(), false, 1_400).notice.as_deref(), Some("Notes can't be taken: Asha Example's Comms needs updating."));    let (again, _) = step(&call, Event::Notes { on: true }, 1_500);    assert!(screen(&l, &again, "Asha Example", pic(), false, 1_600).notice.is_none(), "asked again: the words go");    let (group, _) = step(&group_live(), frame(serde_json::json!({ "t": "notes", "stopped": "cannot_show", "member": "m2" })), 1_500);    let s = group_screen(&l, &group, "Invented Family", pic(), false, &[], None, 1_600, &named);    assert_eq!(s.notice.as_deref(), Some("Notes stopped: Ravi Example's Comms needs updating."));    let (many, _) = step(&group_live(), frame(serde_json::json!({ "t": "notes", "refused": "cannot_show", "members": ["m1", "m2"] })), 1_500);    let s = group_screen(&l, &many, "Invented Family", pic(), false, &[], None, 1_600, &named);    assert_eq!(s.notice.as_deref(), Some("Notes can't be taken: Asha Example, Ravi Example need to update Comms."));}/// The iPhone's preview of a group call (`-chat-warm-call group|group8|group-notes`, Comms Dev): the core's own screens/// for invented calls, written to `apps/cotton/Sources/CottonUI/Resources/Fixtures/chat-group-call.json`. Run it after/// the screen's shape or words change: `cargo test -p cotton-core write_group_call_seed -- --ignored`.#[test]#[ignore]fn write_group_call_seed() {    let l = lines();    // Four on video: Asha talking, Ravi muted, Meera still rung, you.    let four = group_screen(&l, &group_live(), "Invented Family", pic(), false, &[], None, 1_400, &named);    // Eight on a voice call: seven others and you, two muted, one talking.    let callees = (1..=7).map(|n| Callee { number: format!("+1555010000{n}"), person: None, name: None }).collect::<Vec<_>>();    let (call, _) = step(&Call::idle(), Event::Dial { uuid: "G8".into(), callees, video: false, group: Some(GROUP.into()) }, 1_000);    let started = Started { room: ROOM.into(), credential: "c".into(), ice_servers: vec![], ttl: 60, ring_for: 45, mode: crate::calling::wire::Mode::Sfu, me: Some("caller".into()), group: Some(GROUP.into()) };    let (call, _) = step(&call, Event::Started(started), 1_100);    let mut members = vec![member("caller", "+15550100000", "joined", true, false, false)];    for n in 1..=7 {        members.push(member(&format!("v{n}"), &format!("+1555010000{n}"), "joined", n % 3 != 0, false, n == 2));    }    let roster = serde_json::from_value(serde_json::json!({ "t": "roster", "members": members })).unwrap();    let (call, _) = step(&call, Event::Frame(roster), 1_200);    let call = step(&call, Event::Frame(RoomFrame::State { state: crate::calling::wire::RoomState::Live, at: None }), 1_300).0;    let names = ["Asha Example", "Ravi Example", "Meera Example", "Kofi Example", "Lena Example", "Tomas Example", "Yuki Example"];    let eight_named = |m: &crate::calling::wire::Member| -> (String, Picture) {        let name = m.id.strip_prefix('v').and_then(|n| n.parse::<usize>().ok()).and_then(|n| names.get(n - 1)).copied().unwrap_or("The Owner");        (name.into(), Picture { photo: None, initials: lay_initials(name), tint: (name.len() % 6) as u32 })    };    let eight = group_screen(&l, &call, "Invented Book Club", pic(), true, &[], None, 1_400, &eight_named);    // Notes: Asha takes notes on the four's call.    let taking = serde_json::from_value(serde_json::json!({ "t": "member", "member": { "id": "m1", "number": "+15550100001", "state": "joined", "audio": true, "video": true, "notes": true, "can": ["notes"] } })).unwrap();    let (noted, _) = step(&group_live(), Event::Frame(taking), 1_500);    let notes = group_screen(&l, &noted, "Invented Family", pic(), false, &[], None, 1_600, &named);    // Notes refused on the four's call: Ravi's Comms cannot show the mark.    let said = serde_json::from_value(serde_json::json!({ "t": "notes", "refused": "cannot_show", "members": ["m2"] })).unwrap();    let (refusing, _) = step(&group_live(), Event::Frame(said), 1_500);    let refused = group_screen(&l, &refusing, "Invented Family", pic(), false, &[], None, 1_600, &named);    let fixture = serde_json::json!({        "_about": "chat.callScreen on invented group calls, written by cotton-core messages::app::calls_tests::write_group_call_seed",        "group": four, "group8": eight, "group-notes": notes, "group-notice": refused,    });    let path = cotton_store::manifest_dir().join("../../apps/cotton/Sources/CottonUI/Resources/Fixtures/chat-group-call.json");    std::fs::write(&path, serde_json::to_string_pretty(&fixture).unwrap() + "\n").unwrap();}// RULE (owner, 23 Nov 2026; chat CONTRACT "Take notes"): a live call of two offers Take notes when the other person's// Comms can show the mark, never otherwise; while notes are taken both phones draw the mark, and the taker's control// says Stop notes.#[test]fn a_call_of_two_offers_take_notes_and_marks_it() {    let l = lines();    let frame = |v: serde_json::Value| Event::Frame(serde_json::from_value(v).unwrap());    let (call, _) = step(&placed(false), frame(serde_json::json!({ "t": "state", "state": "connecting" })), 1_150);    let (call, _) = step(&call, Event::Media(crate::calling::wire::MediaState::Connected), 1_200);    let ids = |s: &CallScreen| s.controls.iter().map(|c| c.id.clone()).collect::<Vec<_>>();    let (old, _) = step(&call, frame(serde_json::json!({ "t": "roster", "members": [{ "id": "callee:x", "number": "+15550100001", "state": "joined" }, { "id": "caller", "number": "+15550100000", "state": "joined", "can": ["notes"] }] })), 1_300);    assert!(!ids(&screen(&l, &old, "Asha Example", pic(), false, 1_400)).contains(&"notes".to_string()), "an app that cannot show the mark: no Take notes");    let (call, _) = step(&call, frame(serde_json::json!({ "t": "roster", "members": [{ "id": "callee:x", "number": "+15550100001", "state": "joined", "can": ["notes"] }, { "id": "caller", "number": "+15550100000", "state": "joined", "can": ["notes"] }] })), 1_300);    let s = screen(&l, &call, "Asha Example", pic(), false, 1_400);    let notes = s.controls.iter().find(|c| c.id == "notes").unwrap_or_else(|| panic!("Take notes is offered: {:?} {:?}", call.phase, call.members));    assert_eq!((notes.label.as_str(), notes.on), ("Take notes", false));    assert!(s.notes.is_none());    let (mine, _) = step(&call, frame(serde_json::json!({ "t": "member", "member": { "id": "caller", "number": "+15550100000", "state": "joined", "notes": true, "can": ["notes"] } })), 1_500);    let s = screen(&l, &mine, "Asha Example", pic(), false, 1_600);    assert_eq!(s.notes.as_ref().map(|m| m.line.as_str()), Some("You are taking notes"));    let notes = s.controls.iter().find(|c| c.id == "notes").unwrap();    assert_eq!((notes.label.as_str(), notes.on), ("Stop notes", true));    let (theirs, _) = step(&call, frame(serde_json::json!({ "t": "member", "member": { "id": "callee:x", "number": "+15550100001", "state": "joined", "notes": true, "can": ["notes"] } })), 1_500);    assert_eq!(screen(&l, &theirs, "Asha Example", pic(), false, 1_600).notes.map(|m| m.line), Some("Asha Example is taking notes".to_string()));    // Stopped: the mark goes and a line says so.    let (done, _) = step(&theirs, frame(serde_json::json!({ "t": "member", "member": { "id": "callee:x", "number": "+15550100001", "state": "joined", "notes": false, "can": ["notes"] } })), 1_700);    let said = screen(&l, &done, "Asha Example", pic(), false, 1_800).notes.expect("a line says notes stopped");    assert_eq!((said.line.as_str(), said.mark), ("Asha Example stopped taking notes", false));    let (mine_done, _) = step(&mine, frame(serde_json::json!({ "t": "member", "member": { "id": "caller", "number": "+15550100000", "state": "joined", "notes": false, "can": ["notes"] } })), 1_700);    assert_eq!(screen(&l, &mine_done, "Asha Example", pic(), false, 1_800).notes.map(|m| m.line), Some("You stopped taking notes".to_string()));}