memnite-ingest 0.2.1

Extensible ingestion layer for memnite: the IngestSource plugin seam plus Repo Brain and crumbex graph adapters.
Documentation
use memnite_ingest::{slugify, split_h2_sections};

#[test]
fn slugify_normalizes() {
    assert_eq!(slugify("Repo Brain"), "repo-brain");
    assert_eq!(slugify("AUDIT_STATE.yaml"), "audit-state-yaml");
    assert_eq!(slugify("  Multi  --  Engine  "), "multi-engine");
    assert_eq!(slugify("ünîcode!!!"), "nicode");
}

#[test]
fn split_h2_sections_splits_on_column_zero_headings() {
    let md = "# Title\npreamble\n## Alpha\nbody a1\nbody a2\n## Beta\nbody b\n";
    let secs = split_h2_sections(md);
    assert_eq!(secs.len(), 2);
    assert_eq!(
        secs[0],
        ("Alpha".to_string(), "body a1\nbody a2".to_string())
    );
    assert_eq!(secs[1], ("Beta".to_string(), "body b".to_string()));
}

#[test]
fn split_h2_ignores_indented_headings() {
    let md = "## Real\nbody\n    ## NotAHeading\nmore body\n";
    let secs = split_h2_sections(md);
    assert_eq!(secs.len(), 1);
    assert_eq!(secs[0].0, "Real");
    assert!(secs[0].1.contains("## NotAHeading"));
}