v1.6.0: Homebrew tap, Pages, PT-BR docs, 6 new test modules

This commit is contained in:
2026-06-20 13:30:13 -03:00
parent 1791f6d321
commit b14430ee32
12 changed files with 365 additions and 2 deletions
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bats
setup() {
load '../lib/colors.sh'
load '../lib/check.sh'
}
@test "run_preformat_check exits cleanly" {
run run_preformat_check 2>/dev/null || true
[ "$status" -eq 0 ]
}
@test "check_upgrade_safety exits cleanly" {
run check_upgrade_safety 2>/dev/null || true
[ "$status" -eq 0 ]
}
@test "run_preformat_check contains SAFE or MDM" {
run run_preformat_check 2>/dev/null || true
echo "$output" | grep -qiE "safe|mdm"
}
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env bats
setup() {
load '../lib/colors.sh'
load '../lib/config.sh'
CONFIG_FILE=$(mktemp)
}
teardown() {
rm -f "$CONFIG_FILE"
}
@test "load_config handles missing file" {
CONFIG_FILE="/nonexistent/config"
run load_config
[ "$status" -eq 0 ]
}
@test "save_config writes key=value" {
save_config "WEBHOOK" "https://example.com" 2>/dev/null || true
run grep "WEBHOOK=https://example.com" "$CONFIG_FILE"
[ "$status" -eq 0 ]
}
@test "load_config reads saved values" {
save_config "LOG_LEVEL" "verbose" 2>/dev/null || true
VERBOSE=false
load_config
[ "$VERBOSE" = true ]
}
@test "save_config updates existing key" {
save_config "KEY" "old" 2>/dev/null || true
save_config "KEY" "new" 2>/dev/null || true
run grep -c "KEY=new" "$CONFIG_FILE"
[ "$output" -eq 1 ]
}
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env bats
setup() {
load '../lib/colors.sh'
load '../lib/detect.sh'
load '../lib/doctor.sh'
}
@test "run_doctor exits cleanly" {
run run_doctor 2>/dev/null || true
[ "$status" -eq 0 ]
}
@test "run_doctor detects missing libs" {
local old_dir="$LIB_DIR"
LIB_DIR="/nonexistent"
run run_doctor 2>/dev/null || true
LIB_DIR="$old_dir"
echo "$output" | grep -qi "missing\|error"
}
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bats
setup() {
load '../lib/colors.sh'
load '../lib/history.sh'
}
@test "show_history exits cleanly with no logs" {
run show_history 2>/dev/null || true
[ "$status" -eq 0 ]
}
@test "clear_history does not error with no logs" {
run clear_history 2>/dev/null || true
[ "$status" -eq 0 ]
}
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bats
setup() {
load '../lib/colors.sh'
load '../lib/uninstall.sh'
}
@test "do_uninstall requires root" {
EUID=501
run do_uninstall 2>/dev/null || true
[ "$status" -ne 0 ]
}
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bats
setup() {
load '../lib/colors.sh'
load '../lib/whitelist.sh'
TEST_DIR=$(mktemp -d)
mkdir -p "$TEST_DIR/etc/pf.anchors"
}
teardown() {
rm -rf "$TEST_DIR"
}
@test "install_selective_block creates anchor" {
run install_selective_block "$TEST_DIR" 2>/dev/null || true
[ -f "$TEST_DIR/etc/pf.anchors/com.unleash.selective" ]
}
@test "install_selective_block contains MDM domains" {
run install_selective_block "$TEST_DIR" 2>/dev/null || true
run grep -c "mdmenrollment" "$TEST_DIR/etc/pf.anchors/com.unleash.selective"
[ "$output" -gt 0 ]
}