MCPcopy
hub / github.com/yjs/yjs / compareIdSets

Function compareIdSets

tests/testHelper.js:311–324  ·  view source on GitHub ↗
(idSet1, idSet2)

Source from the content-addressed store, hash-verified

309 * @param {Y.IdSet} idSet2
310 */
311export const compareIdSets = (idSet1, idSet2) => {
312 t.assert(idSet1.clients.size === idSet2.clients.size)
313 for (const [client, _items1] of idSet1.clients.entries()) {
314 const items1 = _items1.getIds()
315 const items2 = idSet2.clients.get(client)?.getIds()
316 t.assert(items2 !== undefined && items1.length === items2.length)
317 for (let i = 0; i < items1.length; i++) {
318 const di1 = items1[i]
319 const di2 = /** @type {Array<import('../src/utils/IdSet.js').IdRange>} */ (items2)[i]
320 t.assert(di1.clock === di2.clock && di1.len === di2.len)
321 }
322 }
323 return true
324}
325
326/**
327 * only use for testing

Callers 8

testIdsetMergeFunction · 0.90
testDiffingFunction · 0.90
testRepeatRandomDiffingFunction · 0.90
testRepeatRandomDeletesFunction · 0.90
testRepeatRandomDiffing2Function · 0.90
compareFunction · 0.85

Calls 2

getIdsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…