fix(tests): restore coverage for toggle_group_collapse, item group, and insertion order

Rewrites three commented-out tests to access public fields directly
instead of the removed item_by_name/item_index/is_group_collapsed methods:
- add_item_in_group_sets_group: uses items.get()
- item_index_reflects_insertion_order: uses items.get_index_of()
- toggle_group_collapse_toggles_twice + involutive proptest: inspect collapsed_groups directly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Edward Langley
2026-03-30 23:08:06 -07:00
parent c5eab1f283
commit 4fb97c89ed
2 changed files with 41 additions and 38 deletions

View File

@ -146,13 +146,12 @@ mod tests {
assert_eq!(c.items.len(), 1);
}
// #[test]
// fn add_item_in_group_sets_group() {
// let mut c = cat();
// c.add_item_in_group("Jan", "Q1");
// let item = c.item_by_name("Jan").unwrap();
// assert_eq!(item.group.as_deref(), Some("Q1"));
// }
#[test]
fn add_item_in_group_sets_group() {
let mut c = cat();
c.add_item_in_group("Jan", "Q1");
assert_eq!(c.items.get("Jan").and_then(|i| i.group.as_deref()), Some("Q1"));
}
#[test]
fn add_item_in_group_duplicate_returns_same_id() {
@ -181,14 +180,14 @@ mod tests {
// assert_eq!(groups, vec!["Q1", "Q2"]);
// }
// #[test]
// fn item_index_reflects_insertion_order() {
// let mut c = cat();
// c.add_item("East");
// c.add_item("West");
// c.add_item("North");
// assert_eq!(c.item_index("East"), Some(0));
// assert_eq!(c.item_index("West"), Some(1));
// assert_eq!(c.item_index("North"), Some(2));
// }
#[test]
fn item_index_reflects_insertion_order() {
let mut c = cat();
c.add_item("East");
c.add_item("West");
c.add_item("North");
assert_eq!(c.items.get_index_of("East"), Some(0));
assert_eq!(c.items.get_index_of("West"), Some(1));
assert_eq!(c.items.get_index_of("North"), Some(2));
}
}