mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-10-30 00:45:49 +08:00
[Refactor] add nvm_get_artifact_compression
This commit is contained in:
committed by
Jordan Harband
parent
a5742d4e9e
commit
d396181ffb
16
test/fast/Unit tests/nvm_get_artifact_compression
Executable file
16
test/fast/Unit tests/nvm_get_artifact_compression
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
cleanup () {
|
||||
unset -f die cleanup
|
||||
}
|
||||
die () { echo "$@" ; cleanup ; exit 1; }
|
||||
|
||||
\. ../../../nvm.sh
|
||||
|
||||
# nvm_get_artifact_compression by default
|
||||
[ "$(nvm_get_artifact_compression)" = 'tar.gz' ] || die 'nvm_get_artifact_compression should return "tar.gz" by default'
|
||||
|
||||
# nvm_get_artifact_compression with xz
|
||||
[ "$(nvm_get_artifact_compression "14.0.0")" = 'tar.xz' ] || die 'nvm_get_artifact_compression should return "tar.xz" for this version'
|
||||
|
||||
cleanup
|
||||
@@ -31,14 +31,14 @@ nvm_download() {
|
||||
nvm_get_checksum_alg() {
|
||||
echo 'sha-256'
|
||||
}
|
||||
OUTPUT="$(nvm_get_checksum node std foo bar baz)"
|
||||
OUTPUT="$(nvm_get_checksum node std foo bar tar.baz)"
|
||||
EXPECTED_OUTPUT="mirror-node-std/foo/SHASUMS256.txt"
|
||||
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "expected >${EXPECTED_OUTPUT}<, got >${OUTPUT}<"
|
||||
|
||||
nvm_get_checksum_alg() {
|
||||
echo 'sha-1'
|
||||
}
|
||||
OUTPUT="$(nvm_get_checksum iojs std foo bar baz)"
|
||||
OUTPUT="$(nvm_get_checksum iojs std foo bar tar.baz)"
|
||||
EXPECTED_OUTPUT="mirror-iojs-std/foo/SHASUMS.txt"
|
||||
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "expected >${EXPECTED_OUTPUT}<, got >${OUTPUT}<"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user