Skip to content

Commit

Permalink
[Tests] add some nvm_do_install tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 28, 2022
1 parent afd4a96 commit 65a0cfc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/install_script/nvm_do_install
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ NVM_ENV=testing \. ../../install.sh

#nvm_do_install is available
type nvm_do_install > /dev/null 2>&1 || die 'nvm_do_install is not available'

FILE_PATH="$(pwd)/nvm_do_install"
EXIT_CODE=$(NVM_DIR="${FILE_PATH}" nvm_do_install 2>&1 >/dev/null; echo $?)
[ "${EXIT_CODE}" = '1' ] || die 'nvm_do_install should fail if NVM_DIR is a file'

ACTUAL="$(NVM_DIR="${FILE_PATH}" nvm_do_install 2>&1)"
EXPECTED="File \"${FILE_PATH}\" has the same name as installation directory."
[ "${ACTUAL}" = "${EXPECTED}" ] || die "got <${ACTUAL}>, expected <${EXPECTED}>"

0 comments on commit 65a0cfc

Please sign in to comment.