1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 14:26:46 +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

@@ -88,3 +88,29 @@ EOF
[ "$status" -eq 0 ]
[[ "$output" == *"Skipped: No permission"* ]]
}
@test "is_critical_system_component matches known system services" {
run bash --noprofile --norc <<'EOF'
set -euo pipefail
source "$PROJECT_ROOT/lib/core/app_protection.sh"
is_critical_system_component "backgroundtaskmanagement" && echo "yes"
is_critical_system_component "SystemSettings" && echo "yes"
EOF
[ "$status" -eq 0 ]
[[ "${lines[0]}" == "yes" ]]
[[ "${lines[1]}" == "yes" ]]
}
@test "is_critical_system_component ignores non-system names" {
run bash --noprofile --norc <<'EOF'
set -euo pipefail
source "$PROJECT_ROOT/lib/core/app_protection.sh"
if is_critical_system_component "myapp"; then
echo "bad"
else
echo "ok"
fi
EOF
[ "$status" -eq 0 ]
[[ "$output" == "ok" ]]
}