diff --git a/crates/cli/tests/install_uninstall_test.rs b/crates/cli/tests/install_uninstall_test.rs index 7db381dd2..07dffe552 100644 --- a/crates/cli/tests/install_uninstall_test.rs +++ b/crates/cli/tests/install_uninstall_test.rs @@ -333,6 +333,7 @@ mod install_uninstall { assert!(tools.tools.get("node").is_none()); } + #[cfg(not(windows))] #[test] fn symlinks_bin_when_pinning() { let temp = create_empty_sandbox(); @@ -346,25 +347,17 @@ mod install_uninstall { .arg("--no-bundled-npm") .assert(); - let link = temp - .path() - .join("bin") - .join(if cfg!(windows) { "node.exe" } else { "node" }); + let link = temp.path().join("bin").join("node"); assert!(link.exists()); assert_eq!( std::fs::read_link(link).unwrap(), - temp.path() - .join("tools/node/19.0.0") - .join(if cfg!(windows) { - "node.exe" - } else { - "bin/node" - }) + temp.path().join("tools/node/19.0.0").join("bin/node") ); } + #[cfg(not(windows))] #[test] fn symlinks_bin_on_first_install_without_pinning() { let temp = create_empty_sandbox(); @@ -377,10 +370,44 @@ mod install_uninstall { .arg("--no-bundled-npm") .assert(); - let link = temp - .path() - .join("bin") - .join(if cfg!(windows) { "node.exe" } else { "node" }); + let link = temp.path().join("bin").join("node"); + + assert!(link.exists()); + } + + #[cfg(windows)] + #[test] + fn creates_bin_when_pinning() { + let temp = create_empty_sandbox(); + + let mut cmd = create_proto_command(temp.path()); + cmd.arg("install") + .arg("node") + .arg("19.0.0") + .arg("--pin") + .arg("--") + .arg("--no-bundled-npm") + .assert(); + + let link = temp.path().join("bin").join("node.exe"); + + assert!(link.exists()); + } + + #[cfg(windows)] + #[test] + fn creates_bin_on_first_install_without_pinning() { + let temp = create_empty_sandbox(); + + let mut cmd = create_proto_command(temp.path()); + cmd.arg("install") + .arg("node") + .arg("19.0.0") + .arg("--") + .arg("--no-bundled-npm") + .assert(); + + let link = temp.path().join("bin").join("node.exe"); assert!(link.exists()); }