@@ -613,6 +613,48 @@ url: https://example.com
613613 const result = parseFrontmatter ( content )
614614 expect ( result . fields . url ) . toBe ( "https://example.com" )
615615 } )
616+
617+ it ( "should throw TypeError for null input" , ( ) => {
618+ expect ( ( ) => parseFrontmatter ( null as unknown as string ) ) . toThrow ( TypeError )
619+ expect ( ( ) => parseFrontmatter ( null as unknown as string ) ) . toThrow (
620+ "parseFrontmatter: content must be a string, got null" ,
621+ )
622+ } )
623+
624+ it ( "should throw TypeError for undefined input" , ( ) => {
625+ expect ( ( ) => parseFrontmatter ( undefined as unknown as string ) ) . toThrow ( TypeError )
626+ expect ( ( ) => parseFrontmatter ( undefined as unknown as string ) ) . toThrow (
627+ "parseFrontmatter: content must be a string, got undefined" ,
628+ )
629+ } )
630+
631+ it ( "should throw TypeError for number input" , ( ) => {
632+ expect ( ( ) => parseFrontmatter ( 123 as unknown as string ) ) . toThrow ( TypeError )
633+ expect ( ( ) => parseFrontmatter ( 123 as unknown as string ) ) . toThrow (
634+ "parseFrontmatter: content must be a string, got number" ,
635+ )
636+ } )
637+
638+ it ( "should throw TypeError for object input" , ( ) => {
639+ expect ( ( ) => parseFrontmatter ( { } as unknown as string ) ) . toThrow ( TypeError )
640+ expect ( ( ) => parseFrontmatter ( { } as unknown as string ) ) . toThrow (
641+ "parseFrontmatter: content must be a string, got object" ,
642+ )
643+ } )
644+
645+ it ( "should throw TypeError for array input" , ( ) => {
646+ expect ( ( ) => parseFrontmatter ( [ ] as unknown as string ) ) . toThrow ( TypeError )
647+ expect ( ( ) => parseFrontmatter ( [ ] as unknown as string ) ) . toThrow (
648+ "parseFrontmatter: content must be a string, got object" ,
649+ )
650+ } )
651+
652+ it ( "should throw TypeError for boolean input" , ( ) => {
653+ expect ( ( ) => parseFrontmatter ( true as unknown as string ) ) . toThrow ( TypeError )
654+ expect ( ( ) => parseFrontmatter ( true as unknown as string ) ) . toThrow (
655+ "parseFrontmatter: content must be a string, got boolean" ,
656+ )
657+ } )
616658 } )
617659
618660 describe ( "validateAgentContent" , ( ) => {
0 commit comments