From 7795050a749bd1111cbbdd9d0219b27226a8e710 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Sat, 14 Mar 2026 13:42:39 +0100 Subject: [PATCH] reproduce #767 --- tests/snapshot.tests.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/snapshot.tests.js b/tests/snapshot.tests.js index 4c495fa9..d64205ee 100644 --- a/tests/snapshot.tests.js +++ b/tests/snapshot.tests.js @@ -226,3 +226,18 @@ export const testContainsUpdate = _tc => { t.assert(Y.snapshotContainsUpdate(snapshotFinal, updates[0])) t.assert(Y.snapshotContainsUpdate(snapshotFinal, updates[1])) } + +/** + * Reported by https://github.com/yjs/yjs/issues/767 + * @param {t.TestCase} _tc + */ +export const testContainsUpdate2 = _tc => { + const local = new Y.Doc(), remote = new Y.Doc() + local.get('t').insert(0, 'abcdefghij') + local.get('t').delete(0, 3) + Y.applyUpdate(remote, Y.encodeStateAsUpdate(local)) + const snap = Y.snapshot(remote) + local.get('t').delete(0, 3) + const update = Y.encodeStateAsUpdate(local) + t.assert(!Y.snapshotContainsUpdate(snap, update)) +}