openpencil/tests/engine/figma/api/clone.test.ts
Danila Poyarkov 9ebc61d78f test(figma): split API coverage
- Move FigmaAPI tests into focused files by feature area
- Share API construction from figma/api/helpers.ts
- Remove FigmaAPI coverage from max-lines exceptions
2026-05-06 13:37:15 +03:00

24 lines
760 B
TypeScript

import { describe, expect, test } from 'bun:test'
import { createAPI } from './helpers'
describe('clone', () => {
test('clone creates a deep copy', () => {
const api = createAPI()
const frame = api.createFrame()
frame.name = 'Original'
frame.fills = [{ type: 'SOLID', color: { r: 1, g: 0, b: 0, a: 1 }, opacity: 1, visible: true }]
const child = api.createRectangle()
child.name = 'Child'
frame.appendChild(child)
const cloned = frame.clone()
expect(cloned.id).not.toBe(frame.id)
expect(cloned.name).toBe('Original')
expect(cloned.fills[0].color.r).toBe(1)
expect(cloned.children.length).toBe(1)
expect(cloned.children[0].name).toBe('Child')
expect(cloned.children[0].id).not.toBe(child.id)
})
})