use crate::monorepo::WorkspacePackage;
use std::path::{Path, PathBuf};
use tempfile::TempDir;
pub(crate) fn setup_test_dir() -> TempDir {
tempfile::tempdir().expect("Failed to create temporary directory for test")
}
pub(crate) fn create_test_package(
name: &str,
version: &str,
location: &str,
root: &Path,
deps: Vec<&str>,
dev_deps: Vec<&str>,
) -> WorkspacePackage {
WorkspacePackage {
name: name.to_string(),
version: version.to_string(),
location: PathBuf::from(location),
absolute_path: root.join(location),
workspace_dependencies: deps.into_iter().map(String::from).collect(),
workspace_dev_dependencies: dev_deps.into_iter().map(String::from).collect(),
}
}