@@ -11,7 +11,6 @@ import {
1111 encodePngAsync ,
1212 retainPngWorker ,
1313 terminatePngWorker ,
14- transcodeScreenshotToPngAsync ,
1514} from './png-worker-client.ts' ;
1615import { cropPngBytes } from './png-crop-bytes.ts' ;
1716import { computeScreenshotDiffPixels } from './screenshot-diff-pixels.ts' ;
@@ -148,39 +147,6 @@ test('decodePngAsync rejects invalid PNG data with the canonical decode AppError
148147 ) ;
149148} ) ;
150149
151- test ( 'transcodeScreenshotToPngAsync matches the synchronous transcoder byte for byte' , async ( ) => {
152- const { encode } = await import ( 'jpeg-js' ) ;
153- const { transcodeScreenshotToPng } = await import ( './screenshot-image.ts' ) ;
154- const rgba = Buffer . alloc ( 9 * 7 * 4 , 0x66 ) ;
155- const jpeg = encode ( { width : 9 , height : 7 , data : rgba } , 90 ) . data ;
156-
157- const fromWorker = await runOnWorkerThread ( 'jpeg-to-png' , ( ) =>
158- transcodeScreenshotToPngAsync ( jpeg , 'fixture' ) ,
159- ) ;
160-
161- assert . deepEqual ( fromWorker , transcodeScreenshotToPng ( jpeg , 'fixture' ) ) ;
162- assert . equal ( PNG . sync . read ( fromWorker ) . width , 9 ) ;
163- } ) ;
164-
165- test ( 'transcodeScreenshotToPngAsync returns a PNG untouched without a worker round trip' , async ( ) => {
166- const png = PNG . sync . write ( new PNG ( { width : 2 , height : 2 } ) ) ;
167-
168- assert . equal ( await transcodeScreenshotToPngAsync ( png , 'fixture' ) , png ) ;
169- } ) ;
170-
171- test ( 'transcodeScreenshotToPngAsync rejects a corrupt JPEG with the canonical decode AppError' , async ( ) => {
172- const corrupt = Buffer . concat ( [ Buffer . from ( [ 0xff , 0xd8 , 0xff , 0xe0 ] ) , Buffer . alloc ( 16 , 0 ) ] ) ;
173-
174- await assert . rejects ( transcodeScreenshotToPngAsync ( corrupt , 'fixture' ) , ( error ) => {
175- assert . equal ( error instanceof AppError , true ) ;
176- assert . equal ( ( error as AppError ) . code , 'COMMAND_FAILED' ) ;
177- assert . match ( ( error as AppError ) . message , / F a i l e d t o d e c o d e f i x t u r e a s J P E G / ) ;
178- assert . equal ( ( error as AppError ) . details ?. label , 'fixture' ) ;
179- assert . ok ( String ( ( error as AppError ) . details ?. reason ) . length > 0 ) ;
180- return true ;
181- } ) ;
182- } ) ;
183-
184150test ( 'decodeScreenshotImageAsync answers the synchronous decoder for both containers' , async ( ) => {
185151 const { encode } = await import ( 'jpeg-js' ) ;
186152 const { decodeScreenshotImage } = await import ( './screenshot-image.ts' ) ;
0 commit comments