refactor: CheckFreshness and DiffDiagram take &str instead of &Path

This commit is contained in:
2026-06-17 13:17:02 +02:00
parent 692a64a622
commit 8f68714977
5 changed files with 99 additions and 10 deletions

View File

@@ -0,0 +1,43 @@
mod fakes;
use archlens_domain::{CodeGraph, NormalizedGraph, ports::DiagramRenderer};
use archlens_application::use_cases::check_freshness::CheckFreshness;
use fakes::FakeDiagramRenderer;
fn empty_graph() -> NormalizedGraph {
NormalizedGraph::from_project(CodeGraph::new())
}
#[test]
fn returns_true_when_content_matches() {
let graph = empty_graph();
let renderer = FakeDiagramRenderer::new();
let rendered = renderer.render(graph.as_graph()).unwrap();
let existing = rendered.files().first().unwrap().content().to_string();
let result = CheckFreshness {
graph: &graph,
renderer: &renderer,
existing_content: &existing,
}
.execute()
.unwrap();
assert!(result);
}
#[test]
fn returns_false_when_content_differs() {
let graph = empty_graph();
let renderer = FakeDiagramRenderer::new();
let result = CheckFreshness {
graph: &graph,
renderer: &renderer,
existing_content: "stale content that does not match",
}
.execute()
.unwrap();
assert!(!result);
}