Files
Brummel c8b5acf6f0 test(cli): pin the viewer tooltip half — INFO maps and md() (refs #125)
The headless viewer suite covered only the DOT half (normalizeModel/
genDot); the tooltip half — INFO.B (collapsed), INFO.C (expanded
cluster), INFO.P (ports), and md()'s markdown-to-HTML step — was
asserted by no test. viewer_tooltip.mjs pins the current shapes;
graph-viewer.js only hoists md() above the browser guard and exports
it (location-only move, no behaviour change), so the pin can drive the
real conversion headlessly. Surfaced by the grounding-check on the #125
composite-doc spec: its viewer assumptions had no current-behaviour pin.

refs #125
2026-07-11 18:30:58 +02:00

40 lines
1.5 KiB
Rust

//! Integration guard: the `aura graph` viewer's tooltip INFO maps (INFO.B for a
//! node body, INFO.C for an expanded composite's cluster frame, INFO.P for a
//! port) and the md() markdown-to-HTML step keep their current exact shape.
//!
//! The property lives in JavaScript (`addInfo`/`genDot`/`md` in
//! assets/graph-viewer.js), so this shells out to `node` running the headless
//! guard `tests/viewer_tooltip.mjs`, which loads the real viewer module and
//! drives the exported `genDot`/`md` over a minimal collapsed+expanded
//! composite / primitive fixture.
//!
//! `node` is REQUIRED: if it is not on PATH this test FAILS (a skipped guard is
//! not a guard).
use std::path::PathBuf;
use std::process::Command;
#[test]
fn viewer_tooltip_info_and_markdown_shapes_are_pinned() {
let script = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("tests")
.join("viewer_tooltip.mjs");
assert!(script.exists(), "guard script missing at {}", script.display());
let out = match Command::new("node").arg(&script).output() {
Ok(out) => out,
Err(e) => panic!(
"node is required for the viewer tooltip guard but could not be run \
({e}); install Node.js or ensure `node` is on PATH"
),
};
let stdout = String::from_utf8_lossy(&out.stdout);
let stderr = String::from_utf8_lossy(&out.stderr);
assert!(
out.status.success(),
"viewer tooltip guard failed (exit {:?}).\n--- node stdout ---\n{stdout}\n--- node stderr ---\n{stderr}",
out.status.code()
);
}