Function
createNode
(
type: SceneNode['type'],
id: string,
overrides: Record<string, unknown> = {},
children?: SceneNode[]
)
Source from the content-addressed store, hash-verified
| 9 | } from '@/utils/component' |
| 10 | |
| 11 | function createNode( |
| 12 | type: SceneNode['type'], |
| 13 | id: string, |
| 14 | overrides: Record<string, unknown> = {}, |
| 15 | children?: SceneNode[] |
| 16 | ): SceneNode { |
| 17 | const base: Record<string, unknown> = { |
| 18 | id, |
| 19 | name: id, |
| 20 | type, |
| 21 | visible: true, |
| 22 | ...overrides |
| 23 | } |
| 24 | if (children) { |
| 25 | base.children = children |
| 26 | } |
| 27 | return base as unknown as SceneNode |
| 28 | } |
| 29 | |
| 30 | describe('utils/component', () => { |
| 31 | it('returns null for nodes without component properties', () => { |
Tested by
no test coverage detected