MCPcopy
hub / github.com/yjs/yjs / testSlice

Function testSlice

tests/y-array.tests.js:48–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 * @param {t.TestCase} _tc
47 */
48export const testSlice = _tc => {
49 const doc1 = new Y.Doc()
50 const arr = doc1.get('array')
51 arr.insert(0, [1, 2, 3])
52 t.compareArrays(arr.slice(0), [1, 2, 3])
53 t.compareArrays(arr.slice(1), [2, 3])
54 t.compareArrays(arr.slice(0, -1), [1, 2])
55 arr.insert(0, [0])
56 t.compareArrays(arr.slice(0), [0, 1, 2, 3])
57 t.compareArrays(arr.slice(0, 2), [0, 1])
58}
59
60/**
61 * @param {t.TestCase} _tc

Callers

nothing calls this directly

Calls 3

getMethod · 0.95
insertMethod · 0.80
sliceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…