-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·44 lines (36 loc) · 929 Bytes
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh -eux
THIS_FILE=$0
THIS_DIR=$(dirname ${THIS_FILE})
test_generate_assets() {
${THIS_DIR}/node_modules/grunt-cli/bin/grunt --gruntfile ${THIS_DIR}/Gruntfile.js generate-assets
}
test_run_server() {
node server.js &
PID=$!
sleep 5s
if ! ps -p ${PID} ; then
echo "node server not running, assuming it's failed to start up"
exit 2
else
echo "node server was still running, assuming it started successfully."
kill_test_server ${PID}
exit 0 # success
fi
}
kill_test_server() {
PID=$1
/bin/kill -SIGTERM ${PID}
sleep 0.5s
if ps -p ${PID} ; then
kill -SIGKILL ${PID}
fi
}
test_for_diabetes_type_2_wording() {
if grep -Rin 'diabetes type 2' "${THIS_DIR}/app/"; then
echo "Found 'diabetes type 2' - should be 'type 2 diabetes'"
exit 3
fi
}
test_for_diabetes_type_2_wording
test_generate_assets
test_run_server