MCPcopy
hub / github.com/yjs/yjs / validateIdMap

Function validateIdMap

tests/testHelper.js:354–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352 * @param {Y.IdMap<T>} idmap
353 */
354export const validateIdMap = idmap => {
355 const copy = Y.createIdMap()
356 idmap.clients.forEach((ranges, client) => {
357 ranges.getIds().forEach(range => {
358 range.attrs.forEach(attr => {
359 t.assert(idmap.attrs.has(attr))
360 t.assert(idmap.attrsH.get(attr.hash()) === attr)
361 copy.add(client, range.clock, range.len, range.attrs.slice())
362 })
363 })
364 t.assert(copy.clients.get(client)?.getIds().length === ranges.getIds().length)
365 })
366 t.assert(idmap.attrsH.size === idmap.attrs.size)
367}
368
369/**
370 * @template T

Callers 1

compareIdmapsFunction · 0.85

Calls 7

hashMethod · 0.80
forEachMethod · 0.45
getIdsMethod · 0.45
hasMethod · 0.45
getMethod · 0.45
addMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…