diff --git a/app/generator/components/PreviewPanel.type-compiler.test.tsx b/app/generator/components/PreviewPanel.type-compiler.test.tsx new file mode 100644 index 000000000..a583ae4ca --- /dev/null +++ b/app/generator/components/PreviewPanel.type-compiler.test.tsx @@ -0,0 +1,48 @@ +import { describe, it, expectTypeOf, expect } from 'vitest'; +import React from 'react'; +import { PreviewPanel } from './PreviewPanel'; + +describe('PreviewPanel Type Compiler Validation', () => { + it('exports PreviewPanel as a callable React component', () => { + expectTypeOf().toBeFunction(); + }); + + it('accepts component props', () => { + type Props = React.ComponentProps; + + expectTypeOf().toMatchObjectType<{ + markdown: string; + }>(); + }); + + it('preserves component prop schema', () => { + type Props = React.ComponentProps; + + expectTypeOf().toEqualTypeOf(); + }); + + it('supports compile-time validation for component props', () => { + const validProps: React.ComponentProps = { + markdown: '# Hello World', + }; + + expect(validProps.markdown).toBe('# Hello World'); + + const invalidProps: React.ComponentProps = { + // @ts-expect-error - markdown must be a string + markdown: 123, + }; + + expect(invalidProps).toBeDefined(); + + expect(invalidProps).toBeDefined(); + }); + + it('accepts a valid props object', () => { + const props: React.ComponentProps = { + markdown: 'Sample markdown', + }; + + expect(props.markdown).toBe('Sample markdown'); + }); +});