fix(tests): restore persistence round-trip assertions using items.get()
The two tests were previously silenced when item_by_name was removed. Rewrites them using category.items.get() directly, restoring coverage of item-name and item-group serialization round-trips. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@ -512,10 +512,8 @@ mod tests {
|
|||||||
fn parse_md_round_trips_categories_and_items() {
|
fn parse_md_round_trips_categories_and_items() {
|
||||||
let m = two_cat_model();
|
let m = two_cat_model();
|
||||||
let m2 = parse_md(&format_md(&m)).unwrap();
|
let m2 = parse_md(&format_md(&m)).unwrap();
|
||||||
assert!(m2.category("Type").is_some());
|
assert!(m2.category("Type").and_then(|c| c.items.get("Food")).is_some());
|
||||||
assert!(m2.category("Month").is_some());
|
assert!(m2.category("Month").and_then(|c| c.items.get("Feb")).is_some());
|
||||||
// assert!(m2.category("Type").unwrap().item_by_name("Food").is_some());
|
|
||||||
// assert!(m2.category("Month").unwrap().item_by_name("Feb").is_some());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -523,9 +521,11 @@ mod tests {
|
|||||||
let mut m = Model::new("T");
|
let mut m = Model::new("T");
|
||||||
m.add_category("Month").unwrap();
|
m.add_category("Month").unwrap();
|
||||||
m.category_mut("Month").unwrap().add_item_in_group("Jan", "Q1");
|
m.category_mut("Month").unwrap().add_item_in_group("Jan", "Q1");
|
||||||
let _ = parse_md(&format_md(&m)).unwrap();
|
let m2 = parse_md(&format_md(&m)).unwrap();
|
||||||
// let item = m2.category("Month").unwrap().item_by_name("Jan").unwrap();
|
assert_eq!(
|
||||||
// assert_eq!(item.group.as_deref(), Some("Q1"));
|
m2.category("Month").and_then(|c| c.items.get("Jan")).and_then(|i| i.group.as_deref()),
|
||||||
|
Some("Q1")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user