added integration test for Game & export_link on Game
This commit is contained in:
27
tests/game_test.rs
Normal file
27
tests/game_test.rs
Normal 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");
|
||||||
|
}
|
||||||
@@ -39,6 +39,13 @@ fn parse_complex() {
|
|||||||
"Installed game wrong path"
|
"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!(
|
assert!(
|
||||||
config
|
config
|
||||||
.game_by_id("sse")
|
.game_by_id("sse")
|
||||||
|
|||||||
Reference in New Issue
Block a user