added integration test for Game & export_link on Game

This commit is contained in:
2026-03-17 14:28:43 +01:00
parent 9df1ec77ef
commit 132f784d58
2 changed files with 34 additions and 0 deletions

27
tests/game_test.rs Normal file
View File

@@ -0,0 +1,27 @@
use std::path::PathBuf;
use fomod_manager::types::RootConfig;
fn get_parent() -> PathBuf {
PathBuf::from(file!()).parent().unwrap().to_owned()
}
fn load_root() -> RootConfig {
RootConfig::load_from_file(get_parent().join("data/root_config_complex.toml")).unwrap()
}
#[test]
fn export_gamefiles() {
let root_config = load_root();
let game = root_config.game_by_id("sse").expect("No game found");
let links = game.export_links().expect("Failed to export game links");
assert!(
links.iter().all(|e| e.src().is_absolute()),
"Link src is not absolute"
);
assert_eq!(links.len(), 4, "Not all files linked");
}

View File

@@ -39,6 +39,13 @@ fn parse_complex() {
"Installed game wrong path"
);
assert!(
config
.game_by_id("sse")
.is_some_and(|e| e.install_location().is_absolute()),
"Relative game path was not resolved to absolute"
);
assert!(
config
.game_by_id("sse")