File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed
Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -15,19 +15,15 @@ describe('Fixture Smoke Test', () => {
1515 // Validate the generated file using comapeocat Reader
1616 const reader = new Reader ( result . outputPath ) ;
1717 const validationResult = await reader . validate ( ) ;
18-
19- // If there are validation errors, log them for debugging
20- if ( Array . isArray ( validationResult ) && validationResult . length > 0 ) {
21- const errors = validationResult . map ( e => `${ e . message } at ${ e . filePath || 'unknown' } ` ) . join ( '\n' ) ;
22- console . error ( 'Validation Errors:\n' , errors ) ;
23- }
24-
25- // Expect no validation errors (returns undefined or empty array on success)
26- if ( validationResult ) {
27- expect ( validationResult ) . toEqual ( [ ] ) ;
28- } else {
29- expect ( validationResult ) . toBeUndefined ( ) ;
18+
19+ const errors = Array . isArray ( validationResult ) ? validationResult : [ ] ;
20+
21+ if ( errors . length > 0 ) {
22+ const message = errors . map ( e => `${ e . message } at ${ e . filePath || 'unknown' } ` ) . join ( '\n' ) ;
23+ console . error ( 'Validation Errors:\n' , message ) ;
3024 }
25+
26+ expect ( errors ) . toHaveLength ( 0 ) ;
3127
3228 // Cleanup
3329 await fs . rm ( result . outputPath ) . catch ( ( ) => { } ) ;
You can’t perform that action at this time.
0 commit comments