fix(discovery): base compatibility warning on selected mod release
This commit is contained in:
1 parent
3259608c3b
commit
bdc78c54e7
2 files changed
+10
-15
No files matched your search
@@ -64,7 +64,7 @@ fn discovery_confirmation_popup_fits_its_summary() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn install_summary_warns_when_chosen_minecraft_or_mod_version_differs() {
|
||||
fn install_summary_checks_selected_mod_release_not_picker_version() {
|
||||
use crate::instance::ContentKind;
|
||||
use crate::net::modrinth::{DiscoveryProject, VersionInfo, VersionType};
|
||||
use ratatui::{Terminal, backend::TestBackend};
|
||||
@@ -110,9 +110,7 @@ fn install_summary_warns_when_chosen_minecraft_or_mod_version_differs() {
|
||||
render_version_popup(frame, frame.area(), &mut state, &picker, Some("26.3"));
|
||||
})
|
||||
.unwrap();
|
||||
let rendered = format!("{}", terminal.backend());
|
||||
assert!(rendered.contains("Mod version may be incompatible with 26.3"));
|
||||
assert!(!rendered.contains("Warning:"));
|
||||
assert!(!format!("{}", terminal.backend()).contains("may be incompatible"));
|
||||
|
||||
state
|
||||
.version_popup
|
||||
@@ -137,6 +135,7 @@ fn install_summary_warns_when_chosen_minecraft_or_mod_version_differs() {
|
||||
assert!(
|
||||
format!("{}", terminal.backend()).contains("Mod version may be incompatible with 26.3")
|
||||
);
|
||||
assert!(!format!("{}", terminal.backend()).contains("Warning:"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1388,17 +1388,13 @@ pub(crate) fn render_version_popup(
|
||||
if popup.confirming && state.kind == crate::instance::ContentKind::Mod && !state.modpacks {
|
||||
instance_game_version
|
||||
.filter(|instance_version| {
|
||||
popup
|
||||
.selected_minecraft_version
|
||||
.as_deref()
|
||||
.is_some_and(|selected| selected != *instance_version)
|
||||
|| popup.selected_version().is_some_and(|version| {
|
||||
!version.game_versions.is_empty()
|
||||
&& !version
|
||||
.game_versions
|
||||
.iter()
|
||||
.any(|game| game == instance_version)
|
||||
})
|
||||
popup.selected_version().is_some_and(|version| {
|
||||
!version.game_versions.is_empty()
|
||||
&& !version
|
||||
.game_versions
|
||||
.iter()
|
||||
.any(|game| game == instance_version)
|
||||
})
|
||||
})
|
||||
.map(|version| format!("Mod version may be incompatible with {version}"))
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user