Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jarelllama authored Apr 1, 2024
1 parent 76f4696 commit e21b447
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions functions/test_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,18 @@ SHELLCHECK() {
# The input.txt file is to be processed by the called script. The out_raw.txt
# file is the expected raw file after processing by the called script.

# TEST: manual addition of domains from repo issue
test_manual_addition() {
# INPUT
printf "https://manual-addition-test.com/folder/\n" >> data/pending/domains_manual.tmp
# EXPECTED OUTPUT
printf "manual-addition-test.com\n" >> out_raw.txt
}

# TEST: conversion from URLs to domains
test_conversion() {
# INPUT
printf "https://conversion-test.com/folder/\n" >> input.txt
printf "https://conversion-test.com/\n" >> input.txt
# EXPECTED OUTPUT
printf "conversion-test.com\n" >> out_raw.txt
}
Expand Down Expand Up @@ -143,7 +151,7 @@ test_known_parked_removal() {
}

# TEST: whitelisted domains removal
test_whitelist_removal() {
test_whitelist_blacklist() {
# Sample whitelist term
printf "whitelist\n" >> "$WHITELIST"
# Sample blacklisted domain
Expand All @@ -156,7 +164,7 @@ test_whitelist_removal() {
printf "whitelist-blacklisted-test.com\n" >> out_raw.txt
printf "whitelist,whitelist-test.com\n" >> out_log.txt
# The check script does not log blacklisted domains
[[ "$script_to_test" == 'check' ]] && return
[[ "$script_to_test" == 'validate' ]] && return
printf "blacklist,whitelist-blacklisted-test.com\n" >> out_log.txt
}

Expand Down Expand Up @@ -196,7 +204,7 @@ test_invalid_removal() {
} >> out_log.txt

# Check script does not save invalid domains to manual review file
[[ "$script_to_test" == 'check' ]] && return
[[ "$script_to_test" == 'validate' ]] && return

{
printf "invalid-test-com\n"
Expand Down Expand Up @@ -289,7 +297,7 @@ TEST_RETRIEVE_VALIDATE() {
fi

test_subdomain_removal
test_whitelist_removal
test_whitelist_blacklist
test_whitelisted_tld_removal
test_invalid_removal
test_redundant_removal
Expand Down

0 comments on commit e21b447

Please sign in to comment.