fix(content): refresh installed provider metadata
This commit is contained in:
1 parent
2d0007de52
commit
ae7a2de19d
17 files changed
+310
-103
No files matched your search
+11
-1
@@ -28,7 +28,14 @@ fn completed_background_instance_is_drained_into_the_ui() {
|
||||
let mut ui = UiHarness::new();
|
||||
ui.add_instance("Existing");
|
||||
ui.add_instance("Pending");
|
||||
let config = ui.app.instances_state.instances.pop().unwrap();
|
||||
let mut config = ui.app.instances_state.instances.pop().unwrap();
|
||||
ui.app.mods_state.loaded_for = Some("Pending".to_owned());
|
||||
ui.app.reconciliation_for = Some(("Pending".to_owned(), config.created));
|
||||
ui.app.content_manifest = Some((
|
||||
"Pending".to_owned(),
|
||||
crate::instance::ContentManifest::default(),
|
||||
));
|
||||
config.created += chrono::TimeDelta::seconds(1);
|
||||
ui.app.instances_state.list_state.selected = Some(0);
|
||||
PENDING_INSTANCES.lock().unwrap().push(config);
|
||||
|
||||
@@ -39,6 +46,9 @@ fn completed_background_instance_is_drained_into_the_ui() {
|
||||
"Pending"
|
||||
);
|
||||
assert!(PENDING_INSTANCES.lock().unwrap().is_empty());
|
||||
assert!(ui.app.reconciliation_for.is_none());
|
||||
assert!(ui.app.content_manifest.is_none());
|
||||
assert!(ui.app.mods_state.loaded_for.is_none());
|
||||
|
||||
ui.draw();
|
||||
assert_eq!(ui.app.mods_state.loaded_for.as_deref(), Some("Pending"));
|
||||
|
||||
@@ -222,6 +222,7 @@ fn managed_mod_record(
|
||||
},
|
||||
},
|
||||
provider_aliases: Vec::new(),
|
||||
provider_checks: Vec::new(),
|
||||
required_dependencies,
|
||||
automatic_dependency,
|
||||
cleanup_eligible: automatic_dependency,
|
||||
@@ -466,6 +467,7 @@ fn provider_conflict_selection_is_persisted() {
|
||||
candidates: candidates.clone(),
|
||||
},
|
||||
provider_aliases: Vec::new(),
|
||||
provider_checks: Vec::new(),
|
||||
required_dependencies: Vec::new(),
|
||||
automatic_dependency: false,
|
||||
cleanup_eligible: false,
|
||||
@@ -491,4 +493,12 @@ fn provider_conflict_selection_is_persisted() {
|
||||
crate::instance::Resolution::Resolved { project }
|
||||
if project.provider == "curseforge" && project.project_id == "second"
|
||||
));
|
||||
assert_eq!(
|
||||
saved.record(&relative_path).unwrap().provider_aliases,
|
||||
vec![ProviderProject {
|
||||
provider: "modrinth".to_owned(),
|
||||
project_id: "first".to_owned(),
|
||||
version_id: "1".to_owned(),
|
||||
}]
|
||||
);
|
||||
}
|
||||
@@ -323,6 +323,7 @@ fn datapack_versions_select_a_world_before_dependency_resolution() {
|
||||
},
|
||||
},
|
||||
provider_aliases: Vec::new(),
|
||||
provider_checks: Vec::new(),
|
||||
required_dependencies: Vec::new(),
|
||||
automatic_dependency: false,
|
||||
cleanup_eligible: false,
|
||||
@@ -437,6 +438,7 @@ fn installed_version_popup_tracks_current_version_and_reinstalls_it() {
|
||||
project_id: "42".to_owned(),
|
||||
version_id: "84".to_owned(),
|
||||
}],
|
||||
provider_checks: vec!["modrinth".to_owned(), "curseforge".to_owned()],
|
||||
required_dependencies: Vec::new(),
|
||||
automatic_dependency: false,
|
||||
cleanup_eligible: false,
|
||||
@@ -445,15 +447,22 @@ fn installed_version_popup_tracks_current_version_and_reinstalls_it() {
|
||||
let request = state
|
||||
.begin_installed_versions(&entry, &record, None)
|
||||
.unwrap();
|
||||
assert_eq!(request.current_version_id.as_deref(), Some("current"));
|
||||
let first_provider = request.provider.clone();
|
||||
let first_version = request.current_version_id.clone().unwrap();
|
||||
assert_eq!(state.version_popup.as_ref().unwrap().sources.len(), 2);
|
||||
state.version_popup.as_mut().unwrap().loading = false;
|
||||
state.version_popup.as_mut().unwrap().versions = vec![version("current")];
|
||||
state.version_popup.as_mut().unwrap().versions = vec![version(&first_version)];
|
||||
assert_eq!(
|
||||
state.version_popup.as_ref().unwrap().title(),
|
||||
"Reinstall Project"
|
||||
);
|
||||
|
||||
let switched = state.switch_version_source().unwrap();
|
||||
assert_ne!(switched.provider, first_provider);
|
||||
let switched_version = switched.current_version_id.clone().unwrap();
|
||||
|
||||
state.version_popup.as_mut().unwrap().loading = false;
|
||||
state.version_popup.as_mut().unwrap().versions = vec![version(&switched_version)];
|
||||
let request = state.begin_dependency_resolution().unwrap();
|
||||
assert!(request.root.force_reinstall);
|
||||
}
|
||||
@@ -882,10 +891,30 @@ fn installed_labels_follow_exact_manifest_projects() {
|
||||
},
|
||||
},
|
||||
provider_aliases: Vec::new(),
|
||||
provider_checks: Vec::new(),
|
||||
required_dependencies: Vec::new(),
|
||||
automatic_dependency: false,
|
||||
cleanup_eligible: false,
|
||||
});
|
||||
let mut sources = vec![(
|
||||
"example-project".to_owned(),
|
||||
crate::instance::ProviderProject {
|
||||
provider: "modrinth".to_owned(),
|
||||
project_id: "project-id".to_owned(),
|
||||
version_id: String::new(),
|
||||
},
|
||||
)];
|
||||
refresh_source_installed_versions(
|
||||
&mut sources,
|
||||
&DiscoveryTarget::Content(Box::new(ContentDiscoveryTarget {
|
||||
instance: instance("test", "1.21.1"),
|
||||
kind: ContentKind::Mod,
|
||||
manifest: Some(manifest.clone()),
|
||||
minecraft_dir: PathBuf::from("first"),
|
||||
})),
|
||||
);
|
||||
assert_eq!(sources[0].1.version_id, "version");
|
||||
|
||||
state.refresh_installed_manifest(&manifest, std::path::Path::new("first"));
|
||||
assert_eq!(
|
||||
state.list.entries[0].title_suffix.as_deref(),
|
||||
|
||||
@@ -665,6 +665,7 @@ fn manifest_metadata_keeps_an_embedded_icon_renderer() {
|
||||
},
|
||||
},
|
||||
provider_aliases: Vec::new(),
|
||||
provider_checks: Vec::new(),
|
||||
required_dependencies: Vec::new(),
|
||||
automatic_dependency: false,
|
||||
cleanup_eligible: false,
|
||||
|
||||
Reference in new issue
Block a user