[Tests] add more checks to make_fake_* helpers
parent
2a513a1bc0
commit
2a5d2c06ff
|
@ -29,8 +29,16 @@ make_fake_node() {
|
|||
VERSION="${1-}"
|
||||
[ -n "${VERSION}" ] || return 1
|
||||
|
||||
local FORMATTED_VERSION
|
||||
FORMATTED_VERSION="$(nvm_format_version "${VERSION}")"
|
||||
|
||||
local BIN_PATH
|
||||
BIN_PATH="$(nvm_version_path "$(nvm_format_version "${VERSION}")")/bin"
|
||||
BIN_PATH="$(nvm_version_path "${FORMATTED_VERSION}")/bin"
|
||||
[ "${BIN_PATH}" != "/bin" ] || {
|
||||
echo >&2 'nvm_version_path was empty'
|
||||
return 5
|
||||
}
|
||||
|
||||
mkdir -p "${BIN_PATH}" || {
|
||||
echo >&2 'unable to make bin dir'
|
||||
return 2
|
||||
|
@ -40,6 +48,11 @@ make_fake_node() {
|
|||
echo >&2 'unable to make fake node bin'
|
||||
return 3
|
||||
}
|
||||
|
||||
nvm_is_version_installed "${FORMATTED_VERSION}" || {
|
||||
echo >&2 'fake node is not installed'
|
||||
return 4
|
||||
}
|
||||
}
|
||||
|
||||
make_fake_iojs() {
|
||||
|
@ -47,8 +60,16 @@ make_fake_iojs() {
|
|||
VERSION="${1-}"
|
||||
[ -n "${VERSION}" ] || return 1
|
||||
|
||||
local FORMATTED_VERSION
|
||||
FORMATTED_VERSION="$(nvm_format_version "iojs-${VERSION}")"
|
||||
|
||||
local BIN_PATH
|
||||
BIN_PATH="$(nvm_version_path "$(nvm_format_version "iojs-${VERSION}")")/bin"
|
||||
BIN_PATH="$(nvm_version_path "${FORMATTED_VERSION}")/bin"
|
||||
[ "${BIN_PATH}" != "/bin" ] || {
|
||||
echo >&2 'nvm_version_path was empty'
|
||||
return 5
|
||||
}
|
||||
|
||||
mkdir -p "${BIN_PATH}" || {
|
||||
echo >&2 'unable to make bin dir'
|
||||
return 2
|
||||
|
@ -62,6 +83,11 @@ make_fake_iojs() {
|
|||
echo >&2 'unable to make fake iojs bin'
|
||||
return 3
|
||||
}
|
||||
|
||||
nvm_is_version_installed "${FORMATTED_VERSION}" || {
|
||||
echo >&2 'fake iojs is not installed'
|
||||
return 4
|
||||
}
|
||||
}
|
||||
|
||||
watch() {
|
||||
|
|
Loading…
Reference in New Issue