@@ -441,36 +441,21 @@ root_type Monster;`
441441 } ) ,
442442 )
443443
444- it . live ( "rejects unsupported image formats like BMP " , ( ) =>
444+ it . live ( "falls through unsupported image mime types to text " , ( ) =>
445445 Effect . gen ( function * ( ) {
446446 const dir = yield * tmpdirScoped ( )
447- // minimal BMP file header
448- const bmp = Buffer . from ( "BM" , "ascii" )
449- yield * put ( path . join ( dir , "image.bmp" ) , bmp )
450-
451- const err = yield * fail ( dir , { filePath : path . join ( dir , "image.bmp" ) } )
452- expect ( err . message ) . toContain ( "image/bmp is not a supported format" )
453- expect ( err . message ) . toContain ( "JPEG, PNG, GIF, WebP" )
454- } ) ,
455- )
456-
457- it . live ( "rejects unsupported image formats like TIFF" , ( ) =>
458- Effect . gen ( function * ( ) {
459- const dir = yield * tmpdirScoped ( )
460- yield * put ( path . join ( dir , "photo.tiff" ) , Buffer . from ( "II" , "ascii" ) )
461-
462- const err = yield * fail ( dir , { filePath : path . join ( dir , "photo.tiff" ) } )
463- expect ( err . message ) . toContain ( "is not a supported format" )
464- } ) ,
465- )
466-
467- it . live ( "rejects unsupported image formats like AVIF" , ( ) =>
468- Effect . gen ( function * ( ) {
469- const dir = yield * tmpdirScoped ( )
470- yield * put ( path . join ( dir , "photo.avif" ) , Buffer . from ( [ 0x00 , 0x00 , 0x00 , 0x1c ] ) )
471-
472- const err = yield * fail ( dir , { filePath : path . join ( dir , "photo.avif" ) } )
473- expect ( err . message ) . toContain ( "is not a supported format" )
447+ const cases = [
448+ [ "image.bmp" , "BM text content" ] ,
449+ [ "photo.tiff" , "II text content" ] ,
450+ [ "photo.avif" , "avif text content" ] ,
451+ ] as const
452+
453+ for ( const item of cases ) {
454+ yield * put ( path . join ( dir , item [ 0 ] ) , item [ 1 ] )
455+ const result = yield * exec ( dir , { filePath : path . join ( dir , item [ 0 ] ) } )
456+ expect ( result . attachments ) . toBeUndefined ( )
457+ expect ( result . output ) . toContain ( item [ 1 ] )
458+ }
474459 } ) ,
475460 )
476461} )
0 commit comments