MCPcopy
hub / github.com/yjs/yjs / testLengthIssue2

Function testLengthIssue2

tests/y-array.tests.js:105–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103 * @param {t.TestCase} _tc
104 */
105export const testLengthIssue2 = _tc => {
106 const doc = new Y.Doc()
107 const next = doc.get()
108 doc.transact(() => {
109 next.insert(0, ['group2'])
110 })
111 doc.transact(() => {
112 next.insert(1, ['rectangle3'])
113 })
114 doc.transact(() => {
115 next.delete(0)
116 next.insert(0, ['rectangle3'])
117 })
118 next.delete(1)
119 doc.transact(() => {
120 next.insert(1, ['ellipse4'])
121 })
122 doc.transact(() => {
123 next.insert(2, ['ellipse3'])
124 })
125 doc.transact(() => {
126 next.insert(3, ['ellipse2'])
127 })
128 doc.transact(() => {
129 doc.transact(() => {
130 t.fails(() => {
131 next.insert(5, ['rectangle2'])
132 })
133 next.insert(4, ['rectangle2'])
134 })
135 doc.transact(() => {
136 // this should not throw an error message
137 next.delete(4)
138 })
139 })
140 console.log(next.toArray())
141}
142
143/**
144 * @param {t.TestCase} tc

Callers

nothing calls this directly

Calls 5

getMethod · 0.95
transactMethod · 0.95
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…