mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 15:04:42 +00:00
Adds iterative empty directory cleanup and smart Edge Updater version management.
This commit is contained in:
@@ -103,6 +103,25 @@ is_path_whitelisted() {
|
||||
[[ "$1" == *"128.0.0.0"* ]] && return 0
|
||||
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
|
||||
|
||||
# Initialize counters
|
||||
files_cleaned=0
|
||||
total_size_cleaned=0
|
||||
total_items=0
|
||||
|
||||
clean_chrome_old_versions
|
||||
|
||||
# Should only clean 129.0.0.0 (not 128.0.0.0 which is whitelisted)
|
||||
echo "Cleaned: $files_cleaned items"
|
||||
EOF
|
||||
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"Cleaned: 1 items"* ]]
|
||||
}
|
||||
|
||||
@test "clean_edge_updater_old_versions keeps latest version" {
|
||||
run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" DRY_RUN=true bash --noprofile --norc <<'EOF'
|
||||
@@ -136,25 +155,6 @@ EOF
|
||||
[[ "$output" == *"dry"* ]]
|
||||
[[ "$output" == *"Cleaned: 2 items"* ]]
|
||||
}
|
||||
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
|
||||
|
||||
# Initialize counters
|
||||
files_cleaned=0
|
||||
total_size_cleaned=0
|
||||
total_items=0
|
||||
|
||||
clean_chrome_old_versions
|
||||
|
||||
# Should only clean 129.0.0.0 (not 128.0.0.0 which is whitelisted)
|
||||
echo "Cleaned: $files_cleaned items"
|
||||
EOF
|
||||
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"Cleaned: 1 items"* ]]
|
||||
}
|
||||
|
||||
@test "clean_chrome_old_versions DRY_RUN mode does not delete files" {
|
||||
# Create test directory
|
||||
|
||||
Reference in New Issue
Block a user