diff --git a/src/main.rs b/src/main.rs index de5d64b..534acdf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -806,8 +806,15 @@ mod test { #[test] fn test_parse_server_configuration() { - let servers = parse_server_configuration("foo:bar,.:fizz/buzz", || Ok(PathBuf::from("/test"))) - .expect("valid server configuration"); + //setup directory structure for test + let home_dir = PathBuf::from("target/test"); + const LOCAL_SERVER_DIR: &str = "fizz/buzz"; + fs::create_dir_all(home_dir.join(LOCAL_SERVER_DIR)).expect("failed to create server directory"); + + let servers = parse_server_configuration(&format!("foo:bar,.:{LOCAL_SERVER_DIR}"), || { + Ok(home_dir.clone()) + }) + .expect("valid server configuration"); assert_eq!( vec![ Server { @@ -818,7 +825,10 @@ mod test { }, Server { address: ServerAddress::Localhost, - server_directory_path: PathBuf::from("/test/fizz/buzz"), + server_directory_path: home_dir + .join(LOCAL_SERVER_DIR) + .canonicalize() + .expect("home dir exists"), } ], servers