Skip to content

Commit e58d825

Browse files
author
Roland Peelen
committed
🎨 - Add tests
1 parent 233aed8 commit e58d825

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

tests/lib/rewatch.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
57150

tests/suffix.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
source "./utils.sh"
2+
cd ../testrepo
3+
4+
bold "Test: It should support custom suffixes"
5+
6+
# Clean Repo
7+
sleep 1
8+
if rewatch clean &> /dev/null;
9+
then
10+
success "Repo Cleaned"
11+
else
12+
error "Error Cleaning Repo"
13+
exit 1
14+
fi
15+
16+
# Replace suffix
17+
replace "s/.mjs/.res.js/g" bsconfig.json
18+
19+
if rewatch build &> /dev/null;
20+
then
21+
success "Repo Built"
22+
else
23+
error "Error building repo"
24+
exit 1
25+
fi
26+
27+
# Count files with new extension
28+
file_count=$(find . -name *.res.js | wc -l)
29+
30+
if [ "$file_count" -eq 9 ];
31+
then
32+
success "Found files with correct suffix"
33+
else
34+
error "Suffix not correctly used"
35+
exit 1
36+
fi
37+
38+
if rewatch clean &> /dev/null;
39+
then
40+
success "Repo Cleaned"
41+
else
42+
error "Error Cleaning Repo"
43+
exit 1
44+
fi
45+
46+
# Restore Suffix
47+
replace "s/.res.js/.mjs/g" bsconfig.json
48+
49+
# Restore original build
50+
if rewatch build &> /dev/null;
51+
then
52+
success "Repo Built"
53+
else
54+
error "Error building repo"
55+
exit 1
56+
fi

tests/suite-ci.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ else
2222
exit 1
2323
fi
2424

25-
./compile.sh && ./watch.sh && ./lock.sh
25+
./compile.sh && ./watch.sh && ./lock.sh && ./suffix.sh

0 commit comments

Comments
 (0)