MCPcopy
hub / github.com/tldraw/tldraw / arrowsAreSound

Function arrowsAreSound

packages/sync-core/src/test/syncFuzz.test.ts:114–132  ·  view source on GitHub ↗
(editor: Editor)

Source from the content-addressed store, hash-verified

112let totalNumPages = 0
113
114function arrowsAreSound(editor: Editor) {
115 const arrows = editor.getCurrentPageShapes().filter((s) => s.type === 'arrow')
116 for (const arrow of arrows) {
117 const bindings = editor.getBindingsFromShape(arrow, 'arrow')
118 const terminalsSeen = new Set()
119 for (const binding of bindings) {
120 if (terminalsSeen.has(binding.props.terminal)) {
121 return false
122 }
123
124 terminalsSeen.add(binding.props.terminal)
125
126 if (!editor.store.has(binding.toId)) {
127 return false
128 }
129 }
130 }
131 return true
132}
133
134function runTest(seed: number) {
135 reseed(seed)

Callers 1

allOkFunction · 0.85

Calls 5

filterMethod · 0.80
getCurrentPageShapesMethod · 0.80
getBindingsFromShapeMethod · 0.80
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…