MCPcopy
hub / github.com/yjs/yjs / testIterators

Function testIterators

tests/y-map.tests.js:17–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15 * @param {t.TestCase} _tc
16 */
17export const testIterators = _tc => {
18 const ydoc = new Y.Doc()
19 /**
20 * @type {Y.Type<{attrs: { [k:string]: number} }>}
21 */
22 const ymap = ydoc.get()
23 // we are only checking if the type assumptions are correct
24 /**
25 * @type {Array<number>}
26 */
27 const vals = Array.from(ymap.attrValues())
28 /**
29 * @type {Array<[string,number]>}
30 */
31 const entries = Array.from(ymap.attrEntries())
32 /**
33 * @type {Array<string>}
34 */
35 const keys = Array.from(ymap.attrKeys())
36 console.log(vals, entries, keys)
37}
38
39export const testNestedMapEvent = () => {
40 const ydoc = new Y.Doc()

Callers

nothing calls this directly

Calls 5

getMethod · 0.95
fromMethod · 0.80
attrValuesMethod · 0.80
attrEntriesMethod · 0.80
attrKeysMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…