from features.rules import load_features, match_features


def test_match_features_keywords(tmp_path):
    cfg = tmp_path / "features.yaml"
    cfg.write_text("""
double_extortion:
  keywords:
    - double extortion
encryption:
  regex:
    - "\\bencrypt(ed|ion|ing)\\b"
""", encoding="utf-8")
    feats = load_features(str(cfg))
    text = "Attackers employ double extortion by encrypting systems."
    result = match_features(text, feats)
    assert result["double_extortion"] is True
    assert result["encryption"] is True


