[Tests] fix nvm_list_aliases test to use mocks for LTS aliases

Jordan Harband 2022-10-26 10:31:26 -07:00
parent e6fa80cb61
commit 4c4b0d64ed
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
1 changed files with 8 additions and 2 deletions

View File

@ -9,14 +9,20 @@ die () {
set -e set -e
MOCKS_DIR="../Unit tests/mocks"
# sample output at the time the test was written
TAB_PATH="$MOCKS_DIR/nodejs.org-dist-index.tab"
nvm_download() {
cat "$TAB_PATH"
}
nvm_alias_path() { nvm_alias_path() {
nvm_echo "../../../alias" nvm_echo "../../../alias"
} }
nvm ls-remote >/dev/null || die 'nvm ls-remote (to populate LTS aliases) failed' nvm ls-remote >/dev/null || die 'nvm ls-remote (to populate LTS aliases) failed'
MOCKS_DIR="../Unit tests/mocks"
EXPECTED_OUTPUT="$(cat "$MOCKS_DIR/lts-star.txt")" EXPECTED_OUTPUT="$(cat "$MOCKS_DIR/lts-star.txt")"
STDOUT_OUTPUT="$(nvm_list_aliases "lts/*")" STDOUT_OUTPUT="$(nvm_list_aliases "lts/*")"
STDERR_OUTPUT="$(nvm_list_aliases "lts/*" 2>&1 >/dev/null)" STDERR_OUTPUT="$(nvm_list_aliases "lts/*" 2>&1 >/dev/null)"