From 9f441eea86c747f266cb0639404e2fcb2d5aba2c Mon Sep 17 00:00:00 2001 From: Jack Phallen Date: Wed, 14 Jan 2026 09:29:05 -0500 Subject: [PATCH] Fix unrelated test failures Fixed WHITELIST_PATTERNS unbound variable error in lib/core/app_protection.sh Updated clean_empty_library_items to match current behavior --- lib/core/app_protection.sh | 5 +++++ tests/clean_user_core.bats | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/core/app_protection.sh b/lib/core/app_protection.sh index 12d2ae8..c9505ef 100755 --- a/lib/core/app_protection.sh +++ b/lib/core/app_protection.sh @@ -12,6 +12,11 @@ readonly MOLE_APP_PROTECTION_LOADED=1 _MOLE_CORE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" [[ -z "${MOLE_BASE_LOADED:-}" ]] && source "$_MOLE_CORE_DIR/base.sh" +# Declare WHITELIST_PATTERNS if not already set (used by is_path_whitelisted) +if ! declare -p WHITELIST_PATTERNS &>/dev/null; then + declare -a WHITELIST_PATTERNS=() +fi + # Application Management # Critical system components protected from uninstallation diff --git a/tests/clean_user_core.bats b/tests/clean_user_core.bats index 18e51a7..47ce16e 100644 --- a/tests/clean_user_core.bats +++ b/tests/clean_user_core.bats @@ -103,7 +103,7 @@ EOF [ "$status" -eq 0 ] } -@test "clean_empty_library_items only cleans empty dirs" { +@test "clean_empty_library_items cleans empty dirs and files" { run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" /bin/bash --noprofile --norc <<'EOF' set -euo pipefail source "$PROJECT_ROOT/lib/core/common.sh" @@ -116,7 +116,7 @@ EOF [ "$status" -eq 0 ] [[ "$output" == *"Empty Library folders"* ]] - [[ "$output" != *"Empty Library files"* ]] + [[ "$output" == *"Empty Library files"* ]] } @test "clean_browsers calls expected cache paths" {