openpencil/packages/scene-graph/tests/basic/helpers.ts
Danila Poyarkov 7b9f506f4a
test: migrate Scene Graph tests into the package and gate new tests/engine files (#790)
Scene Graph unit tests move to packages/scene-graph/tests with a package-local assert helper and test type-checking; five Core- and fig-owned tests move to their owners' engine homes. check:test-homes rejects any new test under tests/engine against a reviewed baseline so the migration debt only shrinks.
2026-09-30 04:53:28 +04:00

9 lines
320 B
TypeScript

import type { SceneGraph } from '@open-pencil/scene-graph'
export function pageId(graph: SceneGraph) {
return graph.getPages()[0].id
}
export function rect(graph: SceneGraph, name: string, x = 0, y = 0, w = 50, h = 50) {
return graph.createNode('RECTANGLE', pageId(graph), { name, x, y, width: w, height: h }).id
}