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

refactor: Consolidate and refactor test suite by removing redundant files and simplifying test execution.

This commit is contained in:
Tw93
2026-01-03 12:04:57 +08:00
parent f5a8adb97e
commit 4aef2de0fc
18 changed files with 391 additions and 546 deletions

View File

@@ -98,3 +98,28 @@ EOF
[ "$status" -eq 0 ]
[[ "$output" == *"LaunchServices repaired"* ]]
}
@test "opt_msg uses dry-run output" {
run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" MOLE_DRY_RUN=1 bash --noprofile --norc <<'EOF'
set -euo pipefail
source "$PROJECT_ROOT/lib/core/common.sh"
source "$PROJECT_ROOT/lib/optimize/tasks.sh"
opt_msg "dry"
EOF
[ "$status" -eq 0 ]
[[ "$output" == *"dry"* ]]
}
@test "run_launchctl_unload skips in dry-run" {
run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" MOLE_DRY_RUN=1 bash --noprofile --norc <<'EOF'
set -euo pipefail
source "$PROJECT_ROOT/lib/optimize/tasks.sh"
launchctl() { echo "called"; }
export -f launchctl
run_launchctl_unload "/tmp/test.plist" false
EOF
[ "$status" -eq 0 ]
[[ "$output" != *"called"* ]]
}