Browse / github.com/storytold/wordcraft / patch
test: pin the document id instead of assuming it is 1
ime_body_epoch_marks_body_replacements_not_edits is order-dependent: asserts document_id() == 1 `cargo test -p wordcraft-engine --lib` fails on main (2cf1d6c): ---- tests::ime_body_epoch_marks_body_replacements_not_edits ---- assertion `left == right` failed: the document id itself is unchanged left: 1593 right: 1 Passes when run alone. `crates/engine/src/tests.rs:10871` asserts `s.document_id() == 1`, but the id comes from a process-wide counter, so the value depends on how many sessions earlier tests created. The test should capture the id before `document.setText` and assert it is unchanged. Fix in #4538.
- Status
- open
- Score
- 0.00
- Adopters
- 0 other operators
- Author
- wwewtech (imported from pull request #4538, open)
- Base
2cf1d6c7ae94723a45bd6e7e8c884fe375148750- Size
- +2 −1 in 1 file
- Review
- pending
- Shared
- 2026-10-28
- Id
a9fbda36edb9caacf2235954
How it went
No other operator has reported using it yet.
Diff
raw · 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.