Skip to content

Commit

Permalink
"refactored and simplified some code"
Browse files Browse the repository at this point in the history
  • Loading branch information
Josee9988 committed Jul 9, 2021
1 parent aa4e414 commit b6c1351
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions tests/project_scaffolding_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,15 @@ suite() {
}

testDotGithubFolder() {
githubFolderFound=0
if [ -e ".github/" ]; then
githubFolderFound=1
if [ ! -e ".github/" ]; then
assertEquals ".github file does not exist" 1 0 # error
fi
assertEquals 1 $githubFolderFound
}

testDotGithubISSUE_TEMPLATE() {
folderFound=0
if [ -e ".github/ISSUE_TEMPLATE" ]; then
folderFound=1
if [ ! -e ".github/ISSUE_TEMPLATE" ]; then
assertEquals ".github/ISSUE_TEMPLATE was not found" 1 0 # error
fi
assertEquals 1 $folderFound
}

testDotGithubISSUE_TEMPLATEFiles() {
Expand All @@ -67,6 +63,7 @@ testDotGithubFiles() {
".github/CODEOWNERS" ".github/CODE_OF_CONDUCT.md" ".github/CONTRIBUTING.md" ".github/ISSUE_TEMPLATE.md"
".github/pull_request_template.md" ".github/SECURITY.md" ".github/SUPPORT.md" ".github/issue_label_bot.yaml"
".github/config.yml" ".github/FUNDING.yml" ".github/settings.yml")

for file in "${files[@]}"; do
assertTrue " $file does not exist" "[ -e \"$file\" ]"
done
Expand All @@ -77,23 +74,23 @@ testTestRemovedFiles() {
if [ -e "tests/" ] && [ -e "tests/shunit2" ] && [ -e "tests/TESTS_RUNNER.sh" ]; then
filesFound=1
fi
assertNotEquals 1 $filesFound
assertNotEquals " tests folder of some files were found" 1 $filesFound
}

testGlobalFiles() {
filesFound=0
if [ -e ".gitignore" ] && [ -e "CHANGELOG.md" ] && [ -e "README.md" ]; then
filesFound=1
fi
assertEquals 1 $filesFound
assertEquals " gitignore, changelog or readme were not found" 1 $filesFound
}

testRemovedFiles() {
filesFound=0
if [ -e "LICENSE" ] && [ -e "bin" ] && [ -e "bin/FUNCTION_HELPERS.sh" ]; then
filesFound=1
fi
assertNotEquals 1 $filesFound
assertNotEquals " LICENSE or the bin directory were found" 1 $filesFound
}

# Load and run shUnit2.
Expand Down

0 comments on commit b6c1351

Please sign in to comment.