File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { describe , it , expectTypeOf } from 'vitest' ;
2+ import React from 'react' ;
3+ import { SectionCard } from './SectionCard' ;
4+
5+ type SectionCardProps = React . ComponentProps < typeof SectionCard > ;
6+
7+ describe ( 'SectionCard Type Compiler Validation' , ( ) => {
8+ it ( 'exports SectionCard as a callable React component' , ( ) => {
9+ expectTypeOf ( SectionCard ) . toBeFunction ( ) ;
10+ } ) ;
11+
12+ it ( 'accepts component props' , ( ) => {
13+ const props : SectionCardProps = {
14+ title : 'Settings' ,
15+ children : < div > Content</ div > ,
16+ } ;
17+
18+ expectTypeOf ( props ) . toEqualTypeOf < SectionCardProps > ( ) ;
19+ } ) ;
20+
21+ it ( 'preserves component prop schema' , ( ) => {
22+ expectTypeOf < SectionCardProps > ( ) . toEqualTypeOf < {
23+ title : string ;
24+ icon ?: string ;
25+ description ?: string ;
26+ children : React . ReactNode ;
27+ defaultOpen ?: boolean ;
28+ badge ?: number ;
29+ } > ( ) ;
30+ } ) ;
31+
32+ it ( 'supports compile-time validation for component props' , ( ) => {
33+ expectTypeOf < SectionCardProps > ( ) . toBeObject ( ) ;
34+ } ) ;
35+
36+ it ( 'accepts a valid props object' , ( ) => {
37+ const props : SectionCardProps = {
38+ title : 'Generator' ,
39+ children : < div /> ,
40+ icon : '⚙️' ,
41+ description : 'Example' ,
42+ defaultOpen : true ,
43+ badge : 2 ,
44+ } ;
45+
46+ expectTypeOf ( props ) . toEqualTypeOf < SectionCardProps > ( ) ;
47+ } ) ;
48+ } ) ;
You can’t perform that action at this time.
0 commit comments