fix(tui): harden rendering and centralize tests
This commit is contained in:
1 parent
9b17ec96c5
commit
64bb5e2d16
66 files changed
+271
-48
No files matched your search
@@ -1,4 +1,7 @@
|
||||
use super::harness::UiHarness;
|
||||
use crate::instance::ProviderProject;
|
||||
use crate::tui::app::ProviderConflictState;
|
||||
use crossterm::event::KeyCode;
|
||||
|
||||
#[test]
|
||||
fn empty_app_renders_the_complete_frame() {
|
||||
@@ -21,3 +24,39 @@ fn active_progress_is_visible_in_the_complete_frame() {
|
||||
assert!(screen.contains("one.jar"));
|
||||
crate::tui::progress::clear();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn instance_delete_confirmation_renders_the_complete_frame() {
|
||||
let mut ui = UiHarness::new();
|
||||
ui.add_instance("Snapshot Instance");
|
||||
ui.key(KeyCode::Char('d'));
|
||||
|
||||
ui.draw();
|
||||
|
||||
insta::assert_snapshot!(ui.screen());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn provider_conflict_renders_the_complete_frame() {
|
||||
let mut ui = UiHarness::new();
|
||||
ui.app.provider_conflict = Some(ProviderConflictState {
|
||||
relative_path: "mods/example.jar".into(),
|
||||
candidates: vec![
|
||||
ProviderProject {
|
||||
provider: "modrinth".to_owned(),
|
||||
project_id: "first".to_owned(),
|
||||
version_id: "1".to_owned(),
|
||||
},
|
||||
ProviderProject {
|
||||
provider: "curseforge".to_owned(),
|
||||
project_id: "second".to_owned(),
|
||||
version_id: "2".to_owned(),
|
||||
},
|
||||
],
|
||||
selected: 0,
|
||||
});
|
||||
|
||||
ui.draw();
|
||||
|
||||
insta::assert_snapshot!(ui.screen());
|
||||
}
|
||||
Reference in new issue
Block a user