From f9d447b13bcb1145bbbc5ff5e82dc7df39718a0e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 20 Nov 2026 17:23:00 -0800 Subject: [PATCH] Tests: the side widget batch test checks that the batch switches documents The test found the polygon's document by its uid, so it passed even when the batch's document.activate step left the active document unchanged. It now asserts that the batch makes document 0 active and leaves the polygon's document. --- crates/mcp/src/tests/shapewidgets.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/mcp/src/tests/shapewidgets.rs b/crates/mcp/src/tests/shapewidgets.rs index bce666d484..ce182358f8 100644 --- a/crates/mcp/src/tests/shapewidgets.rs +++ b/crates/mcp/src/tests/shapewidgets.rs @@ -92,6 +92,8 @@ fn a_batch_that_switches_documents_during_a_side_widget_drag_keeps_its_steps() { {"command": "document.activate", "params": {"index": 0}} ]}); h.call("engine.execute", json!({"command": "command.batch", "params": batch})).unwrap(); + assert_eq!(h.session.active_index(), Some(0), "the batch activates document 0"); + assert_ne!(h.session.doc().unwrap().uid, uid, "the batch leaves the polygon's document"); let st = h.session.documents().iter().find(|d| d.uid == uid).expect("the polygon's document"); let vectorcraft_doc::NodeKind::Path { live, .. } = &st.doc.node(id).unwrap().kind else { panic!("not a path") }; assert!(matches!(live.as_deref(), Some(vectorcraft_doc::LiveShape::Polygon { sides: 7, .. })), "the settled drag: {live:?}");