1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 23:05:08 +00:00

test(purge): cover empty menu options path

This commit is contained in:
Tw93
2026-03-07 20:35:35 +08:00
parent faf29b05f1
commit 42cc50d0fd

View File

@@ -683,6 +683,25 @@ EOF
[[ "$status" -eq 0 ]] || [[ "$status" -eq 2 ]]
}
@test "clean_project_artifacts: handles empty menu options under set -u" {
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/project.sh"
mkdir -p "$HOME/www/test-project/node_modules"
touch "$HOME/www/test-project/package.json"
PURGE_SEARCH_PATHS=("$HOME/www")
get_dir_size_kb() { echo 0; }
clean_project_artifacts </dev/null
EOF
[ "$status" -eq 0 ]
[[ "$output" == *"No artifacts found to purge"* ]]
}
@test "clean_project_artifacts: dry-run does not count failed removals" {
run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" bash --noprofile --norc <<'EOF'
set -euo pipefail