Files
Dicklesworthstone cc42a8ba39 feat(ftui): add CassApp model, snapshot harness, and expanded test coverage
Introduce the foundational FrankenTUI application model (src/ui/app.rs)
implementing an Elm-architecture design with CassApp (Model), CassMsg
(Message), and service trait boundaries. This is the type-definition
layer that all subsequent ftui feature work builds on (bead 2noh9.2.2).

CassApp tracks:
- Search state (query, filters, hits, mode, suggestions)
- Navigation (focus panel, selected indices, scroll offsets)
- Modal state (command palette, export modal, detail view)
- Session metadata (toast manager, update info, source filters)
- Input mode (Normal, Insert, Command)

Add snapshot test harness (tests/ftui_harness_snapshots.rs) with three
baseline snapshots exercising block+paragraph, list+selection, and
ANSI-styled text rendering through the ftui backend. Snapshots live in
tests/snapshots/ for the BLESS review workflow.

Expand test utility module (tests/util/mod.rs) with assert_ftui_snapshot
and assert_ftui_snapshot_ansi helpers that render to ftui::Buffer and
compare against stored .snap files.

Expand CLI dispatch coverage tests with analytics subcommand parsing
(status, tokens, tools, models, cost, rebuild, validate) and TUI
runtime detection tests for the CASS_TUI_RUNTIME environment variable.

Add TUI headless smoke tests for the ftui runtime path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 12:32:18 -06:00

55 lines
1.9 KiB
Rust

//! Snapshot infrastructure smoke tests for FrankenTUI harness integration.
//!
//! These tests establish baseline snapshots under `tests/snapshots/` and
//! validate the BLESS workflow for future ftui UI migration work.
mod util;
use ftui::Style;
use ftui::text::{Span, Text, WrapMode};
use ftui::widgets::block::Block;
use ftui::widgets::borders::Borders;
use ftui::widgets::list::{List, ListItem, ListState};
use ftui::widgets::paragraph::Paragraph;
use ftui::widgets::{StatefulWidget, Widget};
use util::{assert_ftui_snapshot, assert_ftui_snapshot_ansi};
#[test]
fn ftui_snapshot_block_paragraph_baseline() {
assert_ftui_snapshot("ftui_block_paragraph_baseline", 34, 7, |area, frame| {
let paragraph = Paragraph::new(Text::raw(
"Cass ftui harness integration\nSnapshot baseline for migration",
))
.block(Block::default().borders(Borders::ALL).title("cass"));
paragraph.render(area, frame);
});
}
#[test]
fn ftui_snapshot_list_selection_baseline() {
assert_ftui_snapshot("ftui_list_selection_baseline", 28, 6, |area, frame| {
let items = vec![
ListItem::new("search mode: lexical"),
ListItem::new("ranking: balanced"),
ListItem::new("context: medium"),
];
let list = List::new(items).highlight_symbol("> ");
let mut state = ListState::default();
state.select(Some(1));
StatefulWidget::render(&list, area, frame, &mut state);
});
}
#[test]
fn ftui_snapshot_ansi_styled_text_baseline() {
assert_ftui_snapshot_ansi("ftui_styled_text_baseline", 30, 4, |area, frame| {
let text = Text::from_spans([
Span::styled("cass ", Style::new().bold()),
Span::styled("ftui", Style::new().italic()),
Span::raw(" snapshot"),
]);
let paragraph = Paragraph::new(text).wrap(WrapMode::Word);
paragraph.render(area, frame);
});
}