feat: tests, demo, JSON output, VPN kill-switch, more issue responses
- tests/: bats test suite for 8 modules (suppress, heal, firewall, detect, validate, colors, dscl, backup) - demo: simulated full bypass flow for showcasing (no real changes) - --json flag for report and audit commands (machine-readable output) - vpn-kill: pf-based kill-switch that blocks MDM outside VPN tunnel - vpn-kill-remove / vpn-kill-status: manage the kill-switch - Responded to 5 more bypass-mdm issues - CI now includes all new lib files in ShellCheck - Bump 1.4.0 -> 1.5.0
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bats
|
||||
# Tests for colors.sh - run with: bats tests/test_colors.bats
|
||||
|
||||
setup() {
|
||||
load '../lib/colors.sh'
|
||||
TEST_LOG=$(mktemp)
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -f "$TEST_LOG"
|
||||
}
|
||||
|
||||
@test "log writes to LOG_FILE when set" {
|
||||
LOG_FILE="$TEST_LOG"
|
||||
log "INFO" "test message"
|
||||
run grep "test message" "$TEST_LOG"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "log respects VERBOSE for DEBUG" {
|
||||
VERBOSE=false
|
||||
run log "DEBUG" "hidden message"
|
||||
[ -z "$output" ]
|
||||
}
|
||||
|
||||
@test "log shows DEBUG when VERBOSE is true" {
|
||||
VERBOSE=true
|
||||
run log "DEBUG" "visible message"
|
||||
echo "$output" | grep -q "visible"
|
||||
}
|
||||
|
||||
@test "error_exit exits with non-zero" {
|
||||
run error_exit "test error" 2>/dev/null
|
||||
[ "$status" -ne 0 ]
|
||||
}
|
||||
|
||||
@test "header outputs formatted title" {
|
||||
run header "Test Title"
|
||||
[ "$status" -eq 0 ]
|
||||
echo "$output" | grep -q "Test Title"
|
||||
}
|
||||
Reference in New Issue
Block a user