feat(modpacks): check discovered pack updates

This commit is contained in:
objz committed 2026-08-04 21:32:25 +02:00
1 parent f049904466
commit 695ba5a758
25 files changed
+191 -38

No files matched your search

+1
View File
@@ -122,6 +122,7 @@ impl UiHarness {
jvm_args: Vec::new(),
resolution: None,
config_sync_profile: None,
modpack_source: None,
};
std::fs::create_dir_all(self.instance_path(name)).expect("instance directory");
self.app
@@ -42,6 +42,7 @@ fn instance(name: &str, version: &str) -> InstanceConfig {
jvm_args: Vec::new(),
resolution: None,
config_sync_profile: None,
modpack_source: None,
}
}
+3 -24
View File
@@ -15,9 +15,9 @@ use ratatui::{
use super::{
ContentListState, WatcherEventHandling, available_description_width, description_text_width,
diff_directory, diff_event_paths, ellipsize, has_newer_compatible_version,
load_provider_metadata, read_dir_stems, right_aligned_footer_spans, square_icon_columns,
title_suffix_spans, watcher_event_handling, world_descriptions, world_game_mode_color,
diff_directory, diff_event_paths, ellipsize, load_provider_metadata, read_dir_stems,
right_aligned_footer_spans, square_icon_columns, title_suffix_spans, watcher_event_handling,
world_descriptions, world_game_mode_color,
};
fn entry(name: &str) -> ContentEntry {
@@ -695,24 +695,3 @@ async fn provider_metadata_loads_from_cache_without_network() {
assert_eq!(description, "Cached description");
assert!(!update_available);
}
#[test]
fn update_check_requires_the_installed_version_behind_a_newer_result() {
let version = |id: &str| crate::net::modrinth::VersionInfo {
id: id.to_owned(),
project_id: "project".to_owned(),
name: id.to_owned(),
version_number: id.to_owned(),
game_versions: vec!["1.21.1".to_owned()],
loaders: vec!["fabric".to_owned()],
version_type: crate::net::modrinth::VersionType::Release,
dependencies: Vec::new(),
date_published: String::new(),
files: Vec::new(),
};
let versions = vec![version("new"), version("installed")];
assert!(has_newer_compatible_version(&versions, "installed"));
assert!(!has_newer_compatible_version(&versions, "new"));
assert!(!has_newer_compatible_version(&versions, "missing"));
}
+22
View File
@@ -46,6 +46,7 @@ fn synthetic_instance(name: &str) -> InstanceConfig {
jvm_args: vec![],
resolution: None,
config_sync_profile: None,
modpack_source: None,
}
}
@@ -78,3 +79,24 @@ fn instances_list_renders_empty() {
insta::assert_snapshot!(terminal.backend());
}
#[test]
fn managed_modpack_update_is_badged_in_the_instance_list() {
let mut state = State::with_instances(vec![synthetic_instance("Managed Pack")]);
state.modpack_updates.insert("Managed Pack".to_owned());
let backend = TestBackend::new(40, 5);
let mut terminal = Terminal::new(backend).unwrap();
terminal
.draw(|frame| render(frame, frame.area(), FocusedArea::Instances, &mut state))
.unwrap();
let text = terminal
.backend()
.buffer()
.content()
.iter()
.map(|cell| cell.symbol())
.collect::<String>();
assert!(text.contains("Managed Pack Update"));
}
@@ -154,6 +154,7 @@ fn import_modpack_renders_confirm_step() {
override_count: 3,
format: PackFormat::Mrpack,
archive_path: PathBuf::from("/tmp/synthetic.mrpack"),
source: None,
});
}
@@ -197,6 +198,7 @@ fn import_modpack_renders_confirm_step_without_loader_version() {
override_count: 12,
format: PackFormat::Mmc,
archive_path: PathBuf::from("/tmp/vanilla.zip"),
source: None,
});
}
@@ -24,6 +24,7 @@ fn summary() -> ImportSummary {
override_count: 1,
format: PackFormat::Mrpack,
archive_path: PathBuf::from("test.mrpack"),
source: None,
}
}