Creates a new NodeJS app
هذا الالتزام موجود في:
11
src/app.js
Normal file
11
src/app.js
Normal file
@@ -0,0 +1,11 @@
|
||||
function greet(name) {
|
||||
|
||||
return `Hello, ${name}!`;
|
||||
|
||||
}
|
||||
|
||||
module.export = greet;
|
||||
|
||||
if (require.main === module){
|
||||
console.log(greet("World"))
|
||||
}
|
19
src/test.sh
Normal file
19
src/test.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
#src/test.sj
|
||||
EXPECTED=$"Hello, Test!"
|
||||
|
||||
OUTPUT=${node -e "console.log(require('./src/app'))('Test)"}
|
||||
|
||||
if [ "$OUTPUT" == $"$EXPECTED" ]; then
|
||||
|
||||
echo "Test passed!"
|
||||
|
||||
exit 0
|
||||
|
||||
else
|
||||
|
||||
echo "Test failed! Expected '$EXPECTED' but got '$OUTPUT'"
|
||||
|
||||
exit 1
|
||||
fi
|
المرجع في مشكلة جديدة
حظر مستخدم