| 9 | import type { SerializedBlock } from '@/serializer/types' |
| 10 | |
| 11 | function createBlock( |
| 12 | type: string, |
| 13 | id = type, |
| 14 | options?: { subBlocks?: Record<string, unknown> } |
| 15 | ): SerializedBlock { |
| 16 | return { |
| 17 | id, |
| 18 | position: { x: 0, y: 0 }, |
| 19 | config: { |
| 20 | tool: type, |
| 21 | params: options?.subBlocks?.inputFormat ? { inputFormat: options.subBlocks.inputFormat } : {}, |
| 22 | }, |
| 23 | inputs: {}, |
| 24 | outputs: {}, |
| 25 | metadata: { |
| 26 | id: type, |
| 27 | name: `block-${type}`, |
| 28 | category: 'triggers', |
| 29 | ...(options?.subBlocks ? { subBlocks: options.subBlocks } : {}), |
| 30 | } as SerializedBlock['metadata'] & { subBlocks?: Record<string, unknown> }, |
| 31 | enabled: true, |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | describe('start-block utilities', () => { |
| 36 | it.concurrent('buildResolutionFromBlock returns null when metadata id missing', () => { |