Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
jarelllama authored Apr 1, 2024
1 parent e21b447 commit 74a4e0e
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions functions/test_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ TEST_RETRIEVE_VALIDATE() {
# Note removal of domains already in raw file is redundant to test

if [[ "$script_to_test" == 'retrieve' ]]; then
test_manual_addition
test_conversion
test_known_dead_removal
test_known_parked_removal
Expand Down Expand Up @@ -348,6 +349,23 @@ TEST_RETRIEVE_VALIDATE() {
on_exit
}

# TEST: removal of dead domains with subdomains
test_dead_subdomain_check() {
# Dead root domains
printf "584308-dead-subdomain-test.com\n" >> "$RAW"
printf "584308-dead-subdomain-test.com\n" >> "$ROOT_DOMAINS"
while read -r subdomain; do
subdomain="${subdomain}.584308-dead-subdomain-test.com"
# INPUT
printf "%s\n" "$subdomain" >> "$SUBDOMAINS"
# EXPECTED OUTPUT
printf "%s\n" "$subdomain" >> out_dead.txt
done < "$SUBDOMAINS_TO_REMOVE"
# EXPECTED OUTPUT
printf "%s\n" "dead,584308-dead-subdomain-test.com,raw" >> out_log.txt

}

# Function 'TEST_DEAD_CHECK' tests the removal/addition of dead and resurrected
# domains respectively.
TEST_DEAD_CHECK() {
Expand All @@ -364,20 +382,6 @@ TEST_DEAD_CHECK() {
printf "584031dead-domain-test.com\n" >> out_dead.txt
printf "resurrected,google.com,dead_domains_file\n" >> out_log.txt

# TEST: removal of dead domains with subdomains
# Dead root domains
printf "584308-dead-subdomain-test.com\n" >> "$RAW"
printf "584308-dead-subdomain-test.com\n" >> "$ROOT_DOMAINS"
while read -r subdomain; do
subdomain="${subdomain}.584308-dead-subdomain-test.com"
# INPUT
printf "%s\n" "$subdomain" >> "$SUBDOMAINS"
# EXPECTED OUTPUT
printf "%s\n" "$subdomain" >> out_dead.txt
done < "$SUBDOMAINS_TO_REMOVE"
# EXPECTED OUTPUT
printf "%s\n" "dead,584308-dead-subdomain-test.com,raw" >> out_log.txt

# Test removal of dead redundant domains and wildcards
: > "$REDUNDANT_DOMAINS" # Initialize redundant domains file
printf "493053dead-wildcard-test.com\n" >> "$RAW" # Input
Expand Down

0 comments on commit 74a4e0e

Please sign in to comment.