From a60bc0b2a2b2af7f4ee9c1a5f7bf8dc63a17066b Mon Sep 17 00:00:00 2001 From: Caio Pizzol Date: Wed, 15 Apr 2026 18:32:26 -0700 Subject: [PATCH] fix(test): add textBetween/nodesBetween to remap-length tr.doc mock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same root cause as the other three files — the word-diff trim in executor.ts calls tr.doc.textBetween and charOffsetToDocPos (which uses tr.doc.nodesBetween). The remap-length mock needs: - textBetween returning a range-sized unique string (no common prefix/suffix with any replacement) so the trim is a no-op - nodesBetween simulating a single text node so charOffsetToDocPos maps offsets correctly --- .../v1/document-api-adapters/plan-engine/remap-length.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/super-editor/src/editors/v1/document-api-adapters/plan-engine/remap-length.test.ts b/packages/super-editor/src/editors/v1/document-api-adapters/plan-engine/remap-length.test.ts index 50b5b87dba..47e760204a 100644 --- a/packages/super-editor/src/editors/v1/document-api-adapters/plan-engine/remap-length.test.ts +++ b/packages/super-editor/src/editors/v1/document-api-adapters/plan-engine/remap-length.test.ts @@ -123,6 +123,10 @@ function makeTr() { docChanged: true, doc: { resolve: () => ({ marks: () => [] }), + textBetween: vi.fn((from: number, to: number) => '\x01'.repeat(to - from)), + nodesBetween: vi.fn((from: number, to: number, cb: (node: any, pos: number) => void) => { + cb({ isText: true, nodeSize: to - from }, from); + }), }, }; tr.replaceWith.mockReturnValue(tr);