Skip to content

Commit

Permalink
"improved and prepared all the folders for the tests"
Browse files Browse the repository at this point in the history
  • Loading branch information
Josee9988 committed Jul 8, 2021
1 parent fe02d20 commit 8cb8783
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion SETUP_TEMPLATE.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ y | Y)

rm LICENSE # remove the license
rm -r bin/ # remove the bin folder
rm -r tests/ # remove the tests folder
rm -r tests/ 2>/dev/null || : # remove the tests folder
writeREADME # write the new README.md
writeCHANGELOG # write the basic structure of the CHANGELOG.md
echo -e "# add your own funding links" >.github/FUNDING.yml # remove author's custom funding links
Expand Down
4 changes: 2 additions & 2 deletions bin/FUNCTION_HELPERS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ center() {

checkFiles() {
### Check if the .github directory does exist ###
if [ ! -d ".github/" ] || [ ! -d ".github/ISSUE_TEMPLATE" ]; then
if [ ! -d ".github/" ] && [ ! -d ".github/ISSUE_TEMPLATE" ]; then
echo -e "${RED}Directory .github/ DOES NOT EXIST WITH ALL THE FILES NEEDED.${NC}"
displayErrorInstructions
exit 1 # exit with error code 1
fi

### Checks if the root files exist and some extra important files ###
if [ ! -f "CHANGELOG.md" ] || [ ! -f "README.md" ] || [ ! -f ".gitignore" ] || [ ! -f "LICENSE" ] || [ ! -f ".github/settings.yml" ] || [ ! -f ".github/pull_request_template.md" ] || [ ! -f ".github/ISSUE_TEMPLATE/1-bug-report.md" ] || [ ! -f ".github/ISSUE_TEMPLATE/config.yml" ]; then
if [ ! -f "CHANGELOG.md" ] && [ ! -f "README.md" ] && [ ! -f ".gitignore" ] && [ ! -f "LICENSE" ] && [ ! -f ".github/settings.yml" ] && [ ! -f ".github/pull_request_template.md" ] && [ ! -f ".github/ISSUE_TEMPLATE/1-bug-report.md" ] && [ ! -f ".github/ISSUE_TEMPLATE/config.yml" ]; then
echo -e "${RED}The script couldn't find one or many of the template main files${NC}."
displayErrorInstructions
exit 1 # exit with error code 1
Expand Down
4 changes: 2 additions & 2 deletions tests/TESTS_RUNNER.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

# ADD AS MANY LINES AS TESTS FILE YOU HAVE TO RUN THEM ALL

mkdir -p tests/.tests_trash/
mkdir -p tests/.ignore.tests_trash

echo -e "\n\n--------------------------------\nrunning ./tests/project_scaffolding.sh"
./tests/project_scaffolding.sh

rm -r tests/.tests_trash
#rm -r tests/.ignore.tests_trash
24 changes: 16 additions & 8 deletions tests/project_scaffolding.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
#! /bin/bash
# file: examples/arguments_test.sh

TESTS_TRASH_DIR="tests/.tests_trash"
TESTS_TRASH_DIR="tests/.ignore.tests_trash"
USERNAME="FAKE_USERNAME_TESTS"
NAME="FAKE_NAME_TESTS"
MAIL="FAKE_EMAIL_TESTS"
OMIT_STR="--omit-commit-and-confirmation"

cp -r * $TESTS_TRASH_DIR --copy-content 2>/dev/null || :
cp -r .github/ $TESTS_TRASH_DIR --copy-contents
cp -r bin/ $TESTS_TRASH_DIR --copy-contents
rm -r $TESTS_TRASH_DIR/tests/
cp .gitignore $TESTS_TRASH_DIR --copy-contents
rm -r $TESTS_TRASH_DIR/tests/ 2>/dev/null || :
rm -r $TESTS_TRASH_DIR/.git/ 2>/dev/null || :

#cd "tests/.tests_trash" || exit
# TESTS

suite() {
cd $TESTS_TRASH_DIR || exit

bash SETUP_TEMPLATE.sh $USERNAME $NAME $MAIL $OMIT_STR

suite_addTest testDotGithubFolder
suite_addTest testDotGithubISSUE_TEMPLATE
suite_addTest testDotGithubISSUE_TEMPLATEFiles
Expand All @@ -22,7 +30,7 @@ suite() {

testDotGithubFolder() {
githubFolderFound=0
if [ -e "$TESTS_TRASH_DIR/.github/" ]; then
if [ -e ".github/" ]; then
githubFolderFound=1
fi
assertEquals 1 $githubFolderFound
Expand All @@ -31,28 +39,28 @@ testDotGithubFolder() {

testDotGithubISSUE_TEMPLATE() {
folderFound=0
if [ -e "$TESTS_TRASH_DIR/.github/ISSUE_TEMPLATE" ]; then
if [ -e ".github/ISSUE_TEMPLATE" ]; then
folderFound=1
fi
assertEquals 1 $folderFound
}

testDotGithubISSUE_TEMPLATEFiles() {
filesFound=0
if [ -e "$TESTS_TRASH_DIR/.github/ISSUE_TEMPLATE/1-bug-report.md" ] && [ -e "$TESTS_TRASH_DIR/.github/ISSUE_TEMPLATE/2-failing-test.md" ] && [ -e "$TESTS_TRASH_DIR/.github/ISSUE_TEMPLATE/3-docs-bug.md" ] && [ -e "$TESTS_TRASH_DIR/.github/ISSUE_TEMPLATE/4-feature-request.md" ] && [ -e "$TESTS_TRASH_DIR/.github/ISSUE_TEMPLATE/5-enhancement-request.md" ] && [ -e "$TESTS_TRASH_DIR/.github/ISSUE_TEMPLATE/6-security-report.md" ] && [ -e "$TESTS_TRASH_DIR/.github/ISSUE_TEMPLATE/7-question-support.md" ] && [ -e "$TESTS_TRASH_DIR/.github/ISSUE_TEMPLATE/config.yml" ]; then
if [ -e ".github/ISSUE_TEMPLATE/1-bug-report.md" ] && [ -e ".github/ISSUE_TEMPLATE/2-failing-test.md" ] && [ -e ".github/ISSUE_TEMPLATE/3-docs-bug.md" ] && [ -e ".github/ISSUE_TEMPLATE/4-feature-request.md" ] && [ -e ".github/ISSUE_TEMPLATE/5-enhancement-request.md" ] && [ -e ".github/ISSUE_TEMPLATE/6-security-report.md" ] && [ -e ".github/ISSUE_TEMPLATE/7-question-support.md" ] && [ -e ".github/ISSUE_TEMPLATE/config.yml" ]; then
filesFound=1
fi
assertEquals 1 $filesFound
}

testDotGithubFiles() {
filesFound=0
if [ -e "$TESTS_TRASH_DIR/.github/CODEOWNERS" ] && [ -e "$TESTS_TRASH_DIR/.github/CODE_OF_CONDUCT.md" ] && [ -e "$TESTS_TRASH_DIR/.github/CONTRIBUTING.md" ] && [ -e "$TESTS_TRASH_DIR/.github/ISSUE_TEMPLATE.md" ] && [ -e "$TESTS_TRASH_DIR/.github/pull_request_template.md" ] && [ -e "$TESTS_TRASH_DIR/.github/SECURITY.md" ] && [ -e "$TESTS_TRASH_DIR/.github/SUPPORT.md" ] && [ -e "$TESTS_TRASH_DIR/.github/issue_label_bot.yaml" ] && [ -e "$TESTS_TRASH_DIR/.github/config.yml" ] && [ -e "$TESTS_TRASH_DIR/.github/FUNDING.yml" ] && [ -e "$TESTS_TRASH_DIR/.github/settings.yml" ]; then
if [ -e ".github/CODEOWNERS" ] && [ -e ".github/CODE_OF_CONDUCT.md" ] && [ -e ".github/CONTRIBUTING.md" ] && [ -e ".github/ISSUE_TEMPLATE.md" ] && [ -e ".github/pull_request_template.md" ] && [ -e ".github/SECURITY.md" ] && [ -e ".github/SUPPORT.md" ] && [ -e ".github/issue_label_bot.yaml" ] && [ -e ".github/config.yml" ] && [ -e ".github/FUNDING.yml" ] && [ -e ".github/settings.yml" ]; then
filesFound=1
fi
assertEquals 1 $filesFound
}

# Load and run shUnit2.
#cd "../.." || exit
. tests/shunit2
cd "../.." || exit

0 comments on commit 8cb8783

Please sign in to comment.