facett-claude/tests/render.rs
//! Real `egui_kittest` render-proof: the `ui()` path (turns + input + Send button)
//! paints, and the pane renders after a JSON-driven conversation — the visible
//! (watch-on-DISPLAY) leg of the robot scenario the headless drive covers.
use egui_kittest::Harness;
use facett_claude::ClaudePane;
use facett_core::Panel;
#[test]
fn claude_pane_paints_empty() {
let mut pane = ClaudePane::default();
let mut harness = Harness::builder().build_ui(move |ui| {
Panel::ui(&mut pane, ui);
});
harness.run();
// Rendered a frame without panicking — heading + input + Send are on screen.
}
#[test]
fn claude_pane_paints_after_json_conversation() {
let mut pane = ClaudePane::default();
Panel::update_json(&mut pane, r#"{"prompt_changed":"hello"}"#);
Panel::update_json(&mut pane, "\"send\"");
Panel::update_json(&mut pane, r#"{"received_ok":"hi there"}"#);
assert_eq!(Panel::state_json(&pane)["last_assistant"], "hi there");
let mut harness = Harness::builder().build_ui(move |ui| {
Panel::ui(&mut pane, ui);
});
harness.run();
}