From d189e1b84f54b34a057a14dff83250dd775f0b1c Mon Sep 17 00:00:00 2001 From: tw93 Date: Sat, 7 Mar 2026 20:03:11 +0800 Subject: [PATCH] test: fix update and cache cleanup cases --- tests/clean_system_caches.bats | 3 ++- tests/update.bats | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/clean_system_caches.bats b/tests/clean_system_caches.bats index a034c96..9ab37fa 100644 --- a/tests/clean_system_caches.bats +++ b/tests/clean_system_caches.bats @@ -177,7 +177,8 @@ EOF [ "$status" -eq 0 ] [[ "$output" == *"Next.js build cache"* ]] grep -q -- "-P $HOME/CustomProjects " "$find_log" - ! grep -q -- "-P $HOME " "$find_log" + run grep -q -- "-P $HOME " "$find_log" + [ "$status" -eq 1 ] rm -rf "$HOME/CustomProjects" "$HOME/.config/mole" "$fake_bin" "$find_log" } diff --git a/tests/update.bats b/tests/update.bats index cb5c4a3..19954eb 100644 --- a/tests/update.bats +++ b/tests/update.bats @@ -600,7 +600,7 @@ EOF @test "get_homebrew_latest_version prefers brew outdated verbose target version" { run bash --noprofile --norc <<'EOF' set -euo pipefail -MOLE_SKIP_MAIN=1 source "$PROJECT_ROOT/mole" +MOLE_TEST_MODE=1 MOLE_SKIP_MAIN=1 source "$PROJECT_ROOT/mole" brew() { if [[ "${1:-}" == "outdated" ]]; then @@ -625,7 +625,7 @@ EOF @test "get_homebrew_latest_version parses brew info fallback with heading prefix" { run bash --noprofile --norc <<'EOF' set -euo pipefail -MOLE_SKIP_MAIN=1 source "$PROJECT_ROOT/mole" +MOLE_TEST_MODE=1 MOLE_SKIP_MAIN=1 source "$PROJECT_ROOT/mole" brew() { if [[ "${1:-}" == "outdated" ]]; then