use super::{over, seat, world_of};
use serde_json::json;
use tempfile::tempdir;
#[test]
fn a_sign_in_lane_opens_a_stream_and_its_first_frame_is_the_standing() {
let root = tempdir().expect("tmp");
let data = tempdir().expect("tmp");
let ctx = over(
root.path(),
world_of(data.path(), &["home"]),
data.path().to_path_buf(),
crate::cli_outbound::Cli::new("/no/such/litany"),
);
let phone = seat("phone");
crate::registry::register(root.path(), &phone.client, "home").expect("registered");
let request = json!({"op": "login-tail", "workspace": "home", "provider": "acme"});
let mut frames = ctx.follow(&phone, &request).expect("the address resolved");
assert_eq!(
frames.next(),
Some(json!({"ok": true, "kind": "login", "lines": []})),
"the lane opens on the standing"
);
let elsewhere = json!({"op": "login-tail", "workspace": "corp", "provider": "acme"});
assert!(ctx.follow(&phone, &elsewhere).is_none());
}