diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs
--- a/crates/engine/src/tests.rs
+++ b/crates/engine/src/tests.rs
@@ -10865,10 +10865,11 @@ fn ime_body_epoch_marks_body_replacements_not_edits() {
     run(&mut s, "text.insert", json!({"text": " two"}));
     assert_eq!(s.ime_body_epoch(), first, "typing is not a replacement");
 
+    let document_id = s.document_id();
     run(&mut s, "document.setText", json!({"text": "same text"}));
     let replaced = s.ime_body_epoch();
     assert!(replaced > first, "setText replaces the body under the same document id");
-    assert_eq!(s.document_id(), 1, "the document id itself is unchanged");
+    assert_eq!(s.document_id(), document_id, "the document id itself is unchanged");
 
     // The same text again still replaces the body: a composition must not survive on content
     // equality.
