fabro/lib/crates/fabro-api/tests/diff_summary_round_trip.rs
Bryan Helmkamp 23cb211cce
feat(runs): surface diff summary counts
Compute cheap diff stats on checkpoint and terminal events, roll them into run summaries, and use them for the Files Changed tab badge without fetching full file diffs.
2026-05-07 17:34:32 -07:00

37 lines
848 B
Rust

use std::any::{TypeId, type_name};
use fabro_api::types::DiffSummary as ApiDiffSummary;
use fabro_types::DiffSummary;
use serde_json::json;
#[test]
fn diff_summary_reuses_canonical_type() {
assert_same_type::<ApiDiffSummary, DiffSummary>();
}
#[test]
fn diff_summary_serializes_with_required_integer_fields() {
let summary = DiffSummary {
files_changed: 3,
additions: 12,
deletions: 4,
};
assert_eq!(
serde_json::to_value(summary).unwrap(),
json!({
"files_changed": 3,
"additions": 12,
"deletions": 4,
})
);
}
fn assert_same_type<T: 'static, U: 'static>() {
assert_eq!(
TypeId::of::<T>(),
TypeId::of::<U>(),
"{} should be the same type as {}",
type_name::<T>(),
type_name::<U>()
);
}