Skip to content

Commit

Permalink
🎨 - Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandpeelen committed Jan 17, 2024
1 parent 233aed8 commit e58d825
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/lib/rewatch.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
57150
56 changes: 56 additions & 0 deletions tests/suffix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
source "./utils.sh"
cd ../testrepo

bold "Test: It should support custom suffixes"

# Clean Repo
sleep 1
if rewatch clean &> /dev/null;
then
success "Repo Cleaned"
else
error "Error Cleaning Repo"
exit 1
fi

# Replace suffix
replace "s/.mjs/.res.js/g" bsconfig.json

if rewatch build &> /dev/null;
then
success "Repo Built"
else
error "Error building repo"
exit 1
fi

# Count files with new extension
file_count=$(find . -name *.res.js | wc -l)

if [ "$file_count" -eq 9 ];
then
success "Found files with correct suffix"
else
error "Suffix not correctly used"
exit 1
fi

if rewatch clean &> /dev/null;
then
success "Repo Cleaned"
else
error "Error Cleaning Repo"
exit 1
fi

# Restore Suffix
replace "s/.res.js/.mjs/g" bsconfig.json

# Restore original build
if rewatch build &> /dev/null;
then
success "Repo Built"
else
error "Error building repo"
exit 1
fi
2 changes: 1 addition & 1 deletion tests/suite-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ else
exit 1
fi

./compile.sh && ./watch.sh && ./lock.sh
./compile.sh && ./watch.sh && ./lock.sh && ./suffix.sh

0 comments on commit e58d825

Please sign in to comment.