mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 17:55:08 +00:00
refactor(clean): merge app cache/user essentials flow
- reorganize perform_cleanup sections and naming - merge macOS + sandbox caches into clean_app_caches - move recent items and mail downloads into user essentials - update core/user tests for renamed internal helpers
This commit is contained in:
@@ -38,22 +38,27 @@ EOF
|
||||
[[ "$output" != *"Trash"* ]]
|
||||
}
|
||||
|
||||
@test "clean_macos_system_caches calls safe_clean for core paths" {
|
||||
@test "clean_app_caches includes macOS system caches" {
|
||||
run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" bash --noprofile --norc <<'EOF'
|
||||
set -euo pipefail
|
||||
source "$PROJECT_ROOT/lib/core/common.sh"
|
||||
source "$PROJECT_ROOT/lib/clean/user.sh"
|
||||
stop_section_spinner() { :; }
|
||||
start_section_spinner() { :; }
|
||||
safe_clean() { echo "$2"; }
|
||||
clean_macos_system_caches
|
||||
bytes_to_human() { echo "0B"; }
|
||||
note_activity() { :; }
|
||||
files_cleaned=0
|
||||
total_size_cleaned=0
|
||||
total_items=0
|
||||
clean_app_caches
|
||||
EOF
|
||||
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"Saved application states"* ]]
|
||||
[[ "$output" == *"QuickLook"* ]]
|
||||
[[ "$output" == *"Saved application states"* ]] || [[ "$output" == *"App caches"* ]]
|
||||
}
|
||||
|
||||
@test "clean_sandboxed_app_caches skips protected containers" {
|
||||
@test "clean_app_caches skips protected containers" {
|
||||
run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" DRY_RUN=true /bin/bash --noprofile --norc <<'EOF'
|
||||
set -euo pipefail
|
||||
source "$PROJECT_ROOT/lib/core/common.sh"
|
||||
@@ -69,12 +74,12 @@ files_cleaned=0
|
||||
total_size_cleaned=0
|
||||
total_items=0
|
||||
mkdir -p "$HOME/Library/Containers/com.example.app/Data/Library/Caches"
|
||||
process_container_cache "$HOME/Library/Containers/com.example.app"
|
||||
clean_sandboxed_app_caches
|
||||
touch "$HOME/Library/Containers/com.example.app/Data/Library/Caches/test.cache"
|
||||
clean_app_caches
|
||||
EOF
|
||||
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" != *"Sandboxed app caches"* ]]
|
||||
[[ "$output" != *"App caches"* ]] || [[ "$output" == *"already clean"* ]]
|
||||
}
|
||||
|
||||
@test "clean_group_container_caches keeps protected caches and cleans non-protected caches" {
|
||||
|
||||
Reference in New Issue
Block a user