Skip to content

Commit 32d4954

Browse files
committed
Updated tests
1 parent 8150bd0 commit 32d4954

3 files changed

Lines changed: 16 additions & 66 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
"node": ">=10"
3333
},
3434
"scripts": {
35-
"test": "./test/test.sh && ./test/testWithFolderCreation.sh"
35+
"test": "./test/test.sh"
3636
}
3737
}

test/test.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cd $(dirname ${BASH_SOURCE[0]:-$0})
77
function cleanup {
88
RV=$?
99

10-
rm -r tmp0 tmp1 tmp2
10+
rm -r tmp0 tmp1 tmp2 tmp3
1111
if [ -n "$PID" ]; then
1212
kill -s SIGINT $PID 2>/dev/null
1313
fi
@@ -21,7 +21,7 @@ trap cleanup EXIT
2121

2222
echo -n "Node.js: "
2323
node -v
24-
echo -n "hhtp-server-upload: "
24+
echo -n "http-server-upload: "
2525
grep '"version":' ../package.json | cut -d'"' -f4
2626

2727
echo -e "\n----- Create files -----\n"
@@ -37,6 +37,7 @@ echo -e "\n----- Start server -----\n"
3737

3838
export UPLOAD_TMP_DIR=./tmp0/
3939
export TOKEN=test-token
40+
export ENABLE_FOLDER_CREATION=true
4041
node ../http-server-upload.js &
4142
PID=$!
4243

@@ -52,11 +53,23 @@ curl \
5253
http://localhost:8080/upload
5354
echo
5455

56+
echo -e "\n----- Upload files with folder creation -----\n"
57+
58+
curl \
59+
-F "uploads=@tmp1/file.txt" \
60+
-F "path=tmp3" \
61+
-F "token=$TOKEN" \
62+
http://localhost:8080/upload
63+
echo
64+
5565
echo -e "\n----- Check files -----\n"
5666
cmp tmp1/file.txt tmp2/file.txt
5767
echo "file.txt ok"
5868

5969
cmp tmp1/file.bin tmp2/file.bin
6070
echo "file.bin ok"
6171

72+
cmp tmp1/file.txt tmp3/file.txt
73+
echo "file.txt with folder creation ok"
74+
6275
echo -e "\n----- Checks passed -----\n"

test/testWithFolderCreation.sh

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)