mirror of
https://github.com/tw93/Mole.git
synced 2026-02-08 02:09:21 +00:00
feat: enhance clean logic
1. Add recursive empty directory cleanup for Application Support and Caches. 2. Add support for cleaning old Edge Updater versions.
This commit is contained in:
@@ -103,6 +103,39 @@ is_path_whitelisted() {
|
||||
[[ "$1" == *"128.0.0.0"* ]] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
@test "clean_edge_updater_old_versions keeps latest version" {
|
||||
run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" DRY_RUN=true bash --noprofile --norc <<'EOF'
|
||||
set -euo pipefail
|
||||
source "$PROJECT_ROOT/lib/core/common.sh"
|
||||
source "$PROJECT_ROOT/lib/clean/user.sh"
|
||||
|
||||
pgrep() { return 1; }
|
||||
export -f pgrep
|
||||
|
||||
UPDATER_DIR="$HOME/Library/Application Support/Microsoft/EdgeUpdater/apps/msedge-stable"
|
||||
mkdir -p "$UPDATER_DIR"/{117.0.2045.60,118.0.2088.46,119.0.2108.9}
|
||||
|
||||
is_path_whitelisted() { return 1; }
|
||||
get_path_size_kb() { echo "10240"; }
|
||||
bytes_to_human() { echo "10M"; }
|
||||
note_activity() { :; }
|
||||
export -f is_path_whitelisted get_path_size_kb bytes_to_human note_activity
|
||||
|
||||
files_cleaned=0
|
||||
total_size_cleaned=0
|
||||
total_items=0
|
||||
|
||||
clean_edge_updater_old_versions
|
||||
|
||||
echo "Cleaned: $files_cleaned items"
|
||||
EOF
|
||||
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"Edge updater old versions"* ]]
|
||||
[[ "$output" == *"dry"* ]]
|
||||
[[ "$output" == *"Cleaned: 2 items"* ]]
|
||||
}
|
||||
get_path_size_kb() { echo "10240"; }
|
||||
bytes_to_human() { echo "10M"; }
|
||||
note_activity() { :; }
|
||||
|
||||
Reference in New Issue
Block a user