diff --git a/crates/weft-pack/src/main.rs b/crates/weft-pack/src/main.rs index c8a17ed..12461e3 100644 --- a/crates/weft-pack/src/main.rs +++ b/crates/weft-pack/src/main.rs @@ -477,4 +477,35 @@ entry = "ui/index.html" assert!(result.is_err()); let _ = fs::remove_dir_all(&tmp); } + + #[test] + fn list_installed_roots_uses_weft_app_store_when_set() { + let prior = std::env::var("WEFT_APP_STORE").ok(); + unsafe { std::env::set_var("WEFT_APP_STORE", "/custom/store") }; + let roots = list_installed_roots(); + unsafe { + match prior { + Some(v) => std::env::set_var("WEFT_APP_STORE", v), + None => std::env::remove_var("WEFT_APP_STORE"), + } + } + assert_eq!(roots, vec![PathBuf::from("/custom/store")]); + } + + #[test] + fn list_installed_roots_includes_system_path() { + let prior = std::env::var("WEFT_APP_STORE").ok(); + unsafe { std::env::remove_var("WEFT_APP_STORE") }; + let roots = list_installed_roots(); + unsafe { + if let Some(v) = prior { + std::env::set_var("WEFT_APP_STORE", v); + } + } + assert!( + roots + .iter() + .any(|p| p == &PathBuf::from("/usr/share/weft/apps")) + ); + } } diff --git a/scripts/wsl-test.sh b/scripts/wsl-test.sh index 6481129..e57a245 100644 --- a/scripts/wsl-test.sh +++ b/scripts/wsl-test.sh @@ -36,7 +36,7 @@ cargo test -p weft-runtime -- --test-threads=1 2>&1 echo "" echo "==> cargo test -p weft-pack" -cargo test -p weft-pack 2>&1 +cargo test -p weft-pack -- --test-threads=1 2>&1 echo "" echo "ALL DONE"