Skip to content

Commit 42cc50d

Browse files
committed
test(purge): cover empty menu options path
1 parent faf29b0 commit 42cc50d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/purge.bats

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,25 @@ EOF
683683
[[ "$status" -eq 0 ]] || [[ "$status" -eq 2 ]]
684684
}
685685

686+
@test "clean_project_artifacts: handles empty menu options under set -u" {
687+
run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" bash --noprofile --norc <<'EOF'
688+
set -euo pipefail
689+
source "$PROJECT_ROOT/lib/core/common.sh"
690+
source "$PROJECT_ROOT/lib/clean/project.sh"
691+
692+
mkdir -p "$HOME/www/test-project/node_modules"
693+
touch "$HOME/www/test-project/package.json"
694+
695+
PURGE_SEARCH_PATHS=("$HOME/www")
696+
get_dir_size_kb() { echo 0; }
697+
698+
clean_project_artifacts </dev/null
699+
EOF
700+
701+
[ "$status" -eq 0 ]
702+
[[ "$output" == *"No artifacts found to purge"* ]]
703+
}
704+
686705
@test "clean_project_artifacts: dry-run does not count failed removals" {
687706
run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" bash --noprofile --norc <<'EOF'
688707
set -euo pipefail

0 commit comments

Comments
 (0)