1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-11 22:53:59 +00:00

Add 43 test cases

This commit is contained in:
Tw93
2025-11-19 09:49:28 +08:00
parent f8f9d7db7d
commit c018504e5f
4 changed files with 188 additions and 1 deletions

View File

@@ -55,6 +55,39 @@ EOF
run env HOME="$HOME" "$PROJECT_ROOT/mole" clean --dry-run
[ "$status" -eq 0 ]
[[ "$output" == *"Protected: 1"* ]]
[[ "$output" == *"Protected"* ]]
[ -f "$HOME/Library/Caches/WhitelistedApp/data.tmp" ]
}
@test "mo clean protects Maven repository by default" {
mkdir -p "$HOME/.m2/repository/org/example"
echo "dependency" > "$HOME/.m2/repository/org/example/lib.jar"
run env HOME="$HOME" "$PROJECT_ROOT/mole" clean --dry-run
[ "$status" -eq 0 ]
[ -f "$HOME/.m2/repository/org/example/lib.jar" ]
[[ "$output" != *"Maven repository cache"* ]]
}
@test "mo clean respects MO_BREW_TIMEOUT environment variable" {
if ! command -v brew > /dev/null 2>&1; then
skip "Homebrew not installed"
fi
run env HOME="$HOME" MO_BREW_TIMEOUT=5 "$PROJECT_ROOT/bin/clean.sh" --dry-run
[ "$status" -eq 0 ]
}
@test "FINDER_METADATA_SENTINEL in whitelist protects .DS_Store files" {
mkdir -p "$HOME/Documents"
touch "$HOME/Documents/.DS_Store"
cat > "$HOME/.config/mole/whitelist" << EOF
FINDER_METADATA_SENTINEL
EOF
run env HOME="$HOME" "$PROJECT_ROOT/mole" clean --dry-run
[ "$status" -eq 0 ]
[[ "$output" == *"protected by whitelist"* ]]
[ -f "$HOME/Documents/.DS_Store" ]
}