2021-12-17 07:54:38 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
\. ../../../nvm.sh
|
|
|
|
|
|
|
|
die () {
|
|
|
|
echo "$@"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2022-10-27 01:31:26 +08:00
|
|
|
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"
|
|
|
|
}
|
|
|
|
|
2021-12-17 07:54:38 +08:00
|
|
|
nvm_alias_path() {
|
|
|
|
nvm_echo "../../../alias"
|
|
|
|
}
|
|
|
|
|
2021-12-18 05:21:29 +08:00
|
|
|
nvm ls-remote >/dev/null || die 'nvm ls-remote (to populate LTS aliases) failed'
|
|
|
|
|
2021-12-17 07:54:38 +08:00
|
|
|
EXPECTED_OUTPUT="$(cat "$MOCKS_DIR/lts-star.txt")"
|
|
|
|
STDOUT_OUTPUT="$(nvm_list_aliases "lts/*")"
|
|
|
|
STDERR_OUTPUT="$(nvm_list_aliases "lts/*" 2>&1 >/dev/null)"
|
|
|
|
|
|
|
|
[ -z "${STDERR_OUTPUT}" ] || die "expected no stderr output, got >${STDERR_OUTPUT}<"
|
|
|
|
[ "${STDOUT_OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "expected ${EXPECTED_OUTPUT}, got >${STDOUT_OUTPUT}<"
|