//! Integration guard for the `aura chart` viewer's gap handling under a //! multi-cadence (union-spine null-filled) trace. //! //! The CLI aligns taps that fire at different cadences onto a shared union x-axis //! by null-filling the timestamps a tap did not fire at (spec 0056 §6). The //! property "those nulls reach uPlot's data array verbatim — a gap, never dropped, //! never coerced to 0" lives in `chart-viewer.js`, so it cannot be checked from //! Rust. This shells out to `node`, running `tests/chart_viewer_gaps.mjs`, which //! loads the real viewer module and drives the pure `buildCharts` over a sparse //! fixture. `node` is REQUIRED: if absent this test FAILS. use std::path::PathBuf; use std::process::Command; #[test] fn chart_viewer_preserves_union_spine_null_gaps() { let script = PathBuf::from(env!("CARGO_MANIFEST_DIR")) .join("tests") .join("chart_viewer_gaps.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 chart-viewer gap 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(), "chart-viewer gap guard failed (exit {:?}).\n--- node stdout ---\n{stdout}\n--- node stderr ---\n{stderr}", out.status.code() ); }