use super::rt;
use crate::boundary::config::{ConfigFile, Read};
use crate::boundary::{Gesture, Query};
#[test]
fn the_config_familys_reads_round_trip() {
for file in [
ConfigFile::Brazen {
workspace: "ws".to_owned(),
},
ConfigFile::LitanyModels,
ConfigFile::Cadence,
ConfigFile::LitanyWorkflow {
name: "review".to_owned(),
},
] {
rt(Gesture::Ask(Query::Config(Read::File { file })));
}
for origin in [
crate::config_edit::branch::edit::EditOrigin::Advance,
crate::config_edit::branch::edit::EditOrigin::Orphan,
crate::config_edit::branch::edit::EditOrigin::Fork {
source: "base".to_owned(),
},
] {
rt(Gesture::Ask(Query::Config(Read::File {
file: ConfigFile::Branch {
workspace: "ws".to_owned(),
lineage: "strict".to_owned(),
origin,
path: "workflow.yaml".to_owned(),
},
})));
}
rt(Gesture::Ask(Query::Config(Read::Marks {
workspace: "ws".to_owned(),
})));
rt(Gesture::Ask(Query::Config(Read::Roles {
workspace: "ws".to_owned(),
})));
rt(Gesture::Ask(Query::Config(Read::Providers {
workspace: "ws".to_owned(),
})));
rt(Gesture::Ask(Query::Config(Read::Lineages {
workspace: "ws".to_owned(),
})));
rt(Gesture::Ask(Query::Config(Read::Models {
workspace: "ws".to_owned(),
provider: "acme".to_owned(),
})));
}
#[test]
fn the_sign_in_and_its_lane_round_trip() {
rt(Gesture::Act(crate::boundary::Action::Login {
workspace: "ws".to_owned(),
provider: "acme".to_owned(),
}));
rt(Gesture::Ask(Query::LoginTail {
workspace: "ws".to_owned(),
provider: "acme".to_owned(),
}));
}
#[test]
fn a_sign_in_with_no_provider_named_refuses_with_its_usage() {
for verb in ["login", "login-tail"] {
let refusal = crate::boundary::line::parse(&format!("/{verb}"), &super::super::ctx())
.expect_err("a row is required");
assert!(refusal.contains("usage"), "{verb}: {refusal}");
assert!(
crate::boundary::line::parse(&format!("/{verb} a b"), &super::super::ctx()).is_err(),
"{verb}: one word, not a sentence"
);
}
}
#[test]
fn the_learning_loops_pair_round_trips() {
for id in [None, Some("20260906T090000Z-r001".to_owned())] {
rt(Gesture::Ask(Query::Config(Read::Proposals {
workspace: "ws".to_owned(),
id,
})));
}
for verdict in [
crate::proposals::Verdict::Accept,
crate::proposals::Verdict::Reject,
] {
rt(Gesture::Act(crate::boundary::Action::Config(
crate::boundary::config::Write::Proposal(crate::proposals::Settle {
workspace: "ws".to_owned(),
id: "20260906T090000Z-r001".to_owned(),
verdict,
}),
)));
}
}
#[test]
fn the_pairs_usages_refuse_rather_than_guess() {
use crate::boundary::line::parse;
let ctx = crate::boundary::line::tests::ctx();
assert!(parse("/proposals a b", &ctx).is_err());
assert!(parse("/proposal", &ctx).is_err());
assert!(parse("/proposal only-an-id", &ctx).is_err());
assert!(parse("/proposal an-id maybe", &ctx).is_err());
assert!(parse("/proposal an-id accept extra", &ctx).is_err());
}