MCPcopy
hub / github.com/yjs/yjs / testLengthIssue

Function testLengthIssue

tests/y-array.tests.js:76–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74 * @param {t.TestCase} _tc
75 */
76export const testLengthIssue = _tc => {
77 const doc1 = new Y.Doc()
78 const arr = doc1.get('array')
79 arr.push([0, 1, 2, 3])
80 arr.delete(0)
81 arr.insert(0, [0])
82 t.assert(arr.length === arr.toArray().length)
83 doc1.transact(() => {
84 arr.delete(1)
85 t.assert(arr.length === arr.toArray().length)
86 arr.insert(1, [1])
87 t.assert(arr.length === arr.toArray().length)
88 arr.delete(2)
89 t.assert(arr.length === arr.toArray().length)
90 arr.insert(2, [2])
91 t.assert(arr.length === arr.toArray().length)
92 })
93 t.assert(arr.length === arr.toArray().length)
94 arr.delete(1)
95 t.assert(arr.length === arr.toArray().length)
96 arr.insert(1, [1])
97 t.assert(arr.length === arr.toArray().length)
98}
99
100/**
101 * Debugging yjs#314

Callers

nothing calls this directly

Calls 6

getMethod · 0.95
transactMethod · 0.95
pushMethod · 0.80
insertMethod · 0.80
toArrayMethod · 0.80
deleteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…