rustifymyclaw 0.1.1

Run Coding CLI Agents from Messaging Apps - single Rust binary, no server required.
use super::*;

fn gate(ids: &[&str]) -> SecurityGate {
    SecurityGate::new(ids.iter().map(|s| s.to_string()).collect())
}

#[test]
fn allowed_user_passes() {
    let g = gate(&["123456", "user-x"]);
    assert!(g.is_allowed("123456"));
    assert!(g.is_allowed("user-x"));
}

#[test]
fn blocked_user_rejected() {
    let g = gate(&["123456"]);
    assert!(!g.is_allowed("999999"));
}

#[test]
fn empty_allowlist_blocks_all() {
    let g = gate(&[]);
    assert!(!g.is_allowed("anyone"));
    assert!(!g.is_allowed(""));
}

#[test]
fn exact_match_required() {
    // Handles are normalized before entering the gate (no '@', lowercased).
    let g = gate(&["user-x"]);
    assert!(!g.is_allowed("@user-x")); // raw '@' form never matches
    assert!(!g.is_allowed("User-X")); // case mismatch never matches
}