import { expect, test } from 'vitest' import { VideoComponent, defineComponentProjectComponentMetadata, getComponentProjectComponentMetadata, } from './index' test('attaches normalized metadata to decorated function components', () => { const metadata = defineComponentProjectComponentMetadata({ name: 'SceneFrame', description: 'Wraps the scene content in a consistent frame', sourceFile: 'src/components/SceneFrame.tsx', aspectRatio: '16:9', sceneType: 'scene', motion: 'static', tags: ['layout', 'frame'], propsTypeName: 'SceneFrameProps', }) const SceneFrame = () => null const decorated = VideoComponent(metadata)(SceneFrame) expect(decorated).toBe(SceneFrame) expect(getComponentProjectComponentMetadata(SceneFrame)).toEqual(metadata) }) test('attaches normalized metadata to decorated function components', () => { const metadata = defineComponentProjectComponentMetadata({ name: 'SceneTitle', description: 'Renders the title block for scene hero content', sourceFile: 'src/components/SceneTitle.tsx', aspectRatio: '16:9', sceneType: 'intro', motion: 'static', tags: ['title', 'hero'], propsTypeName: 'SceneTitleProps', }) const SceneTitle = () => null const decorated = VideoComponent(metadata)(SceneTitle) expect(decorated).toBe(SceneTitle) expect(getComponentProjectComponentMetadata(SceneTitle)).toEqual(metadata) }) test('attaches metadata to components with required props', () => { type RequiredProps = { title: string } const metadata = defineComponentProjectComponentMetadata({ name: 'RequiredPropsScene', description: 'Exercises required props support', sourceFile: 'src/components/RequiredPropsScene.tsx', aspectRatio: '16:9', sceneType: 'scene', motion: 'static', tags: ['required', 'props'], propsTypeName: 'RequiredProps', }) const RequiredPropsScene = (_props: RequiredProps) => null const decorated = VideoComponent(metadata)(RequiredPropsScene) expect(decorated).toBe(RequiredPropsScene) expect(getComponentProjectComponentMetadata(RequiredPropsScene)).toEqual(metadata) })