mirror of
https://github.com/tj/n.git
synced 2024-11-22 11:37:26 +01:00
37 lines
777 B
Bash
37 lines
777 B
Bash
#!/usr/bin/env bats
|
|
|
|
load shared-functions
|
|
|
|
function setup() {
|
|
unset_n_env
|
|
setup_tmp_prefix
|
|
}
|
|
|
|
function teardown() {
|
|
rm -rf "${TMP_PREFIX_DIR}"
|
|
}
|
|
|
|
|
|
@test "n ls # just plain node" {
|
|
# KISS and just make folders rather than do actual installs
|
|
mkdir -p "${N_PREFIX}/n/versions/node/4.9.1"
|
|
mkdir -p "${N_PREFIX}/n/versions/node/10.15.0"
|
|
|
|
output="$(n ls)"
|
|
[ "${output}" = "node/4.9.1
|
|
node/10.15.0" ]
|
|
}
|
|
|
|
|
|
@test "n list # mixed node and nightly" {
|
|
local NIGHTLY_VERSION="12.0.0-nightly201812104aabd7ed64"
|
|
# KISS and just make folders rather than do actual installs
|
|
mkdir -p "${N_PREFIX}/n/versions/nightly/${NIGHTLY_VERSION}"
|
|
mkdir -p "${N_PREFIX}/n/versions/node/10.15.0"
|
|
|
|
output="$(n list)"
|
|
[ "${output}" = "nightly/${NIGHTLY_VERSION}
|
|
node/10.15.0" ]
|
|
}
|
|
|