MCPcopy Create free account
hub / github.com/ecomfe/tempad-dev / createNode

Function createNode

packages/extension/tests/utils/component.test.ts:11–28  ·  view source on GitHub ↗
(
  type: SceneNode['type'],
  id: string,
  overrides: Record<string, unknown> = {},
  children?: SceneNode[]
)

Source from the content-addressed store, hash-verified

9} from '@/utils/component'
10
11function 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
30describe('utils/component', () => {
31 it('returns null for nodes without component properties', () => {

Callers 1

component.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected