use crate::tui::render::chat::is_deliverable_report;
const TABLE_REPORT: &str = "Here is the breakdown you asked for.\n\n\
| Commit | What |\n\
|--------|------|\n\
| aaaaaaa | first change landed on main with tests |\n\
| bbbbbbb | second change landed on main with tests |\n\
| ccccccc | third change landed on main with tests |\n\n\
All green, nothing pushed.";
#[test]
fn a_table_report_qualifies() {
assert!(is_deliverable_report(TABLE_REPORT));
}
#[test]
fn a_trailing_remark_does_not() {
assert!(!is_deliverable_report("Done. Anything else?"));
}
#[test]
fn long_narration_without_a_table_does_not_qualify() {
let narration = "I am going to check the repo state, then stage the files, \
then commit them, then verify the result once more before reporting back \
to you with what happened and what remains outstanding after that."
.repeat(3);
assert!(narration.chars().count() > 200);
assert!(!is_deliverable_report(&narration));
}
#[test]
fn a_short_table_does_not_qualify() {
assert!(!is_deliverable_report("| a |\n|---|\n| b |"));
}
#[test]
fn a_pipe_character_in_prose_is_not_a_table() {
let prose = "Run `grep foo | wc -l` to count them, and note that a | b \
is the union here. "
.repeat(4);
assert!(prose.chars().count() > 200);
assert!(!is_deliverable_report(&prose));
}
#[test]
fn a_separator_row_is_required() {
let no_sep = "| one | two |\n| three | four |\n".repeat(10);
assert!(no_sep.chars().count() > 200);
assert!(!is_deliverable_report(&no_sep));
}