Browse Source

[Tests] `nvm alias --lts`: add tests

Jordan Harband 9 years ago
parent
commit
f0668fd577
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
  1. 16
      test/fast/Aliases/lts/"nvm alias" should ensure LTS alias dir exists
  2. 10
      test/fast/Aliases/lts/setup_dir
  3. 10
      test/fast/Aliases/lts/teardown_dir

16
test/fast/Aliases/lts/"nvm alias" should ensure LTS alias dir exists

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
#!/bin/sh
set -ex
. ../../../../nvm.sh
. ../../../common.sh
LTS_ALIAS_PATH="$(nvm_alias_path)/lts"
die () { echo $@ ; exit 1; }
[ ! -d "${LTS_ALIAS_PATH}" ] || die "'${LTS_ALIAS_PATH}' exists and should not"
nvm alias >/dev/null 2>&1
[ -d "${LTS_ALIAS_PATH}" ] || die "'${LTS_ALIAS_PATH}' does not exist and should"

10
test/fast/Aliases/lts/setup_dir

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
#!/bin/sh
. ../../../../nvm.sh
LTS_ALIAS_PATH="$(nvm_alias_path)/lts"
if [ -d "${LTS_ALIAS_PATH}" ]; then
mv "${LTS_ALIAS_PATH}" "${LTS_ALIAS_PATH}.bak"
rm -rf "${LTS_ALIAS_PATH}"
fi

10
test/fast/Aliases/lts/teardown_dir

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
#!/bin/sh
. ../../../../nvm.sh
LTS_ALIAS_PATH="$(nvm_alias_path)/lts"
if [ -d "${LTS_ALIAS_PATH}.bak" ]; then
rm -rf "${LTS_ALIAS_PATH}"
mv "${LTS_ALIAS_PATH}.bak" "${LTS_ALIAS_PATH}"
fi
Loading…
Cancel
Save