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

@@ -200,6 +200,7 @@ fn instance() -> InstanceConfig {
jvm_args: Vec::new(),
resolution: None,
config_sync_profile: None,
modpack_source: None,
}
}
+21
View File
@@ -5,3 +5,24 @@ fn registry_falls_back_to_first_capable_provider() {
let registry = ProviderRegistry::modrinth(crate::net::HttpClient::new());
assert_eq!(registry.preferred("unknown").unwrap().id(), "modrinth");
}
#[test]
fn update_check_requires_the_installed_version_behind_a_newer_result() {
let version = |id: &str| 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"));
}
+1
View File
@@ -23,6 +23,7 @@ fn job(name: &str) -> ReconcileJob {
jvm_args: Vec::new(),
resolution: None,
config_sync_profile: None,
modpack_source: None,
},
instances_dir: PathBuf::new(),
client: crate::net::HttpClient::new(),
+2
View File
@@ -179,6 +179,7 @@ async fn migrate_legacy_loader_profile_skips_modern_with_inherits_from() {
jvm_args: Vec::new(),
resolution: None,
config_sync_profile: None,
modpack_source: None,
};
let result =
@@ -227,6 +228,7 @@ async fn migrate_legacy_loader_profile_skips_fabric() {
jvm_args: Vec::new(),
resolution: None,
config_sync_profile: None,
modpack_source: None,
};
let result = migrate_legacy_loader_profile_if_needed(
+1
View File
@@ -26,6 +26,7 @@ fn dummy_config(name: &str) -> InstanceConfig {
jvm_args: vec![],
resolution: None,
config_sync_profile: None,
modpack_source: None,
}
}
+6
View File
@@ -15,6 +15,11 @@ fn instance_config_roundtrips_through_json() {
jvm_args: vec![],
resolution: Some((1920, 1080)),
config_sync_profile: None,
modpack_source: Some(crate::instance::ProviderProject {
provider: "modrinth".to_owned(),
project_id: "pack".to_owned(),
version_id: "version".to_owned(),
}),
};
let json = serde_json::to_string_pretty(&config).expect("serialize");
let parsed: InstanceConfig = serde_json::from_str(&json).expect("deserialize");
@@ -22,6 +27,7 @@ fn instance_config_roundtrips_through_json() {
assert_eq!(parsed.game_version, config.game_version);
assert_eq!(parsed.loader, config.loader);
assert_eq!(parsed.resolution, config.resolution);
assert_eq!(parsed.modpack_source, config.modpack_source);
}
#[test]