MCPcopy
hub / github.com/yjs/yjs / testIteratingArrayContainingTypes

Function testIteratingArrayContainingTypes

tests/y-array.tests.js:444–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442 * @param {t.TestCase} _tc
443 */
444export const testIteratingArrayContainingTypes = _tc => {
445 const y = new Y.Doc()
446 const arr = y.get('arr')
447 const numItems = 10
448 for (let i = 0; i < numItems; i++) {
449 const map = new Y.Type()
450 map.setAttr('value', i)
451 arr.push([map])
452 }
453 let cnt = 0
454 for (const item of arr.toArray()) {
455 t.assert(item.getAttr('value') === cnt++, 'value is correct')
456 }
457 y.destroy()
458}
459
460/**
461 * @param {t.TestCase} _tc

Callers

nothing calls this directly

Calls 6

getMethod · 0.95
destroyMethod · 0.95
setAttrMethod · 0.80
pushMethod · 0.80
toArrayMethod · 0.80
getAttrMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…