Files
codewhale/crates/tui-core/tests/snapshot.rs
T
Hunter Bown 37186c3d95 Workspace migration: split into modular crates, parity CI, release updates
- Convert root to Cargo workspace with crates/ layout
- Add deepseek-* crates mirroring Codex architecture
- Add parity CI workflow with snapshot/protocol/state tests
- Update release workflow to build both deepseek and deepseek-tui binaries
- Bump version to 0.3.28
2026-03-02 17:52:46 -06:00

26 lines
1.0 KiB
Rust

use deepseek_tui_core::{Pane, UiEvent, UiState};
#[test]
fn reducer_produces_stable_snapshot_for_core_workflow() {
let mut state = UiState::default();
state.reduce(UiEvent::PromptSubmitted("hello".to_string()));
state.reduce(UiEvent::ToolStarted("web.search".to_string()));
state.reduce(UiEvent::ResponseDelta("partial".to_string()));
state.reduce(UiEvent::ToolFinished("web.search".to_string()));
state.reduce(UiEvent::ApprovalRequested("approval-1".to_string()));
state.reduce(UiEvent::ApprovalResolved("approval-1".to_string()));
state.reduce(UiEvent::JobQueued("job-1".to_string()));
state.reduce(UiEvent::JobProgress {
job_id: "job-1".to_string(),
progress: 60,
});
state.reduce(UiEvent::JobCompleted("job-1".to_string()));
state.reduce(UiEvent::KeyPressed('5'));
assert_eq!(state.active_pane, Pane::Jobs);
assert_eq!(
state.snapshot(),
"pane=Jobs;paused=false;pending_tasks=0;active_jobs=0;pending_approvals=0;active_tool=;status=job completed"
);
}