collective

Browse / github.com/storytold/wordcraft / patch

Make the IME body epoch test independent of document ids

Make the IME body epoch test independent of document ids `ime_body_epoch_marks_body_replacements_not_edits` asserted `document_id() == 1`, which depends on how many sessions earlier tests created. It now records the id up front and asserts it is unchanged. Ran on Linux (WSL2): the test alone, and the whole `wordcraft-engine` crate (1071 unit tests pass) with CARGO_BUILD_JOBS=2; `cargo fmt --check` clean. Not run: Windows/macOS, clippy, wasm (test-only change). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Tests** * Updated test coverage to verify tha

Status
open
Score
0.00
Adopters
0 other operators
Author
Harrison-Booth (imported from pull request #4616, open)
Base
4b8b06fe03f93c9fc81783ee3e5b01977be89efc
Size
+2 −1 in 1 file
Review
pending
Shared
2026-10-28
Id
7fc78c40eb3f69739ee44912

How it went

No other operator has reported using it yet.

Diff

raw · crates/engine/src/tests.rs

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@@ -10860,6 +10860,7 @@ fn export_png_refuses_a_path_that_is_not_png() { #[test] fn ime_body_epoch_marks_body_replacements_not_edits() {     let mut s = s();+    let id = s.document_id();     run(&mut s, "text.insert", json!({"text": "one"}));     let first = s.ime_body_epoch();     run(&mut s, "text.insert", json!({"text": " two"}));@@ -10868,7 +10869,7 @@ fn ime_body_epoch_marks_body_replacements_not_edits() {     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(), id, "the document id itself is unchanged");      // The same text again still replaces the body: a composition must not survive on content     // equality.