KeiSeiKit-1.0/_primitives/_rust/kei-decompose/tests/parsers_architecture.rs
Parfii-bot a4e667de10 KeiSeiKit-public — clean state
Single-commit clean baseline after security scrub of niche-tells,
project codenames, internal jargon, and contributor-email leaks.

Contents:
- 100 Rust crates (_primitives/_rust/)
- 37 agent manifests (_manifests/) + generated specs (_generated/)
- 67 user-invocable skills (skills/)
- 33 hooks (hooks/)
- Composition blocks (_blocks/)
- Documentation (docs/, README.md)
- TS adapter packages (_ts_packages/)
- Assembler (_assembler/)
- Roles (_roles/)
- Templates (_templates/)
- Forgejo CI (.forgejo/)

Author: Denis Parfionovich <info@greendragon.info>

License: see LICENSE.
2026-05-01 12:09:03 +08:00

38 lines
1.2 KiB
Rust

//! Architecture adapter — numbered recommendation extraction.
use std::path::Path;
use kei_decompose::parsers::{registry, FormatParser};
fn fixture_path() -> std::path::PathBuf {
Path::new(env!("CARGO_MANIFEST_DIR"))
.join("tests/fixtures/sample-arch.md")
}
fn architecture_parser() -> Box<dyn FormatParser> {
let r = registry();
r.into_iter().find(|p| p.name() == "architecture").expect("architecture adapter present")
}
#[test]
fn architecture_parser_detects_decision_record() {
let body = std::fs::read_to_string(fixture_path()).unwrap();
let conf = architecture_parser().detect(&body).as_f64();
assert!(conf >= 0.7, "expected architecture confidence >= 0.7, got {}", conf);
}
#[test]
fn architecture_parser_extracts_three_recommendations() {
let actions = architecture_parser().parse(&fixture_path()).unwrap();
assert_eq!(actions.len(), 3, "expected 3 recommendations, got {}", actions.len());
assert_eq!(actions[0].id, "1");
assert!(actions[0].title.contains("FormatParser trait"));
}
#[test]
fn architecture_parser_marks_source_format() {
let actions = architecture_parser().parse(&fixture_path()).unwrap();
for a in &actions {
assert_eq!(a.source_format, "architecture");
}
}