forked from gigalixir/gigalixir-buildpack-phoenix-static
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile_test.sh
More file actions
executable file
·53 lines (37 loc) · 845 Bytes
/
compile_test.sh
File metadata and controls
executable file
·53 lines (37 loc) · 845 Bytes
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
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source $SCRIPT_DIR/.test_support.sh
# override mix command
MIX_ARGS=()
mix() {
MIX_ARGS=("${MIX_ARGS[@]}" "$@")
}
NPM_ARGS=""
npm() {
NPM_ARGS="$@"
}
# TESTS
######################
suite "compile"
test "package.json with deploy script"
echo '{
"scripts": {
"deploy": "echo deploying"
}
}' > $assets_dir/package.json
source $SCRIPT_DIR/../compile
[ "$NPM_ARGS" == "run deploy" ]
rm $assets_dir/package.json
NPM_ARGS=""
MIX_ARGS=()
test "package.json without deploy script"
echo '{
"scripts": {
"other": "echo deploying"
}
}' > $assets_dir/package.json
source $SCRIPT_DIR/../compile
[ -z "$NPM_ARGS" ]
[ "${MIX_ARGS[0]}" == "assets.deploy" ]
PASSED_ALL_TESTS=true