From 6e7da357332aa5a2977c4fa8bbc8347850e0a6bb Mon Sep 17 00:00:00 2001 From: Sven Rogge Date: Tue, 14 Apr 2026 20:23:03 +0200 Subject: [PATCH] test: add avif-to-avif conversion test with fixture Adds a fixture image in AVIF format and a test verifying that AVIF input can be converted to AVIF output without errors. --- fixtures/image.avif | Bin 0 -> 1218 bytes .../src/images/process-image-handler.spec.ts | 24 ++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 fixtures/image.avif diff --git a/fixtures/image.avif b/fixtures/image.avif new file mode 100644 index 0000000000000000000000000000000000000000..fad2b70315de752b9c16ceae399e653501ec0977 GIT binary patch literal 1218 zcmZQzV30{GsVqn=%S>Ycg51nBLl8SRGZDnUmYZ6V2oeVZ#f+4kA_$X#p&&E41jdHZ zdkW|Xd$xjCHTpSn}fe-|KL1_l&6F{DFW@aAPQn08fkdw*;QUz3-SY}`d zVuocF6cqqzi_C)Ld?3w}SZ3(l$jAed6Ui(tNChz%7?>h}x+VY_0tJ~BnII8n4h{|= zC6-x`3v)lv5zLKD%s{ydxhaVyLJVA75^1V6)hsL~QUXTX*@YOGx-=F#Y-wCoy}7(3 z$SYmzQJZh5Z2A@D>JMCMyutT(&EK*qB4=*lj-C(ApIMh(%H~R~;Mi~37~}KdZ1$@b z<<_2q-|hTC$lZ>=(Hx1ATk@c3v<%Z`usOMlfZFj0HY&A2~UEHJ1- z&F9f+u2ZHDB)qTSG!ka>8!xE-ATFuISu=`Y*@~%hXvX|WDuFb7q z_2PuM=(3DOt~Nm{+GY3h3RwQ;Xbmi@m;b%#(0A+k!fzI+ug%QLAybs~P&m22ED?@w5@z2cG=_j4t;BTpawsM-1!T**8n7RW{2jMqSG9;3$5X%E>k(#BBQ| z&lQ)H;#7CvZP-%5^>X>ABR`L@a4m~Dm*ZIe#Z2|w{@cM@on$v`uwAdieJyW_x>v`a z>8+WUel?n?PF`1-r!IUTJw^7AIQ3X5D}3Q9&5sdWCgf7rEBA=GuJa>@NzEUZlZQ;6 zS34&&={x7w-*eblx_;9BT+1WEeggLkmFERBJ;=KKf2n>gOF>vozREh@oD-eOS?!!E z7qa`m)N@Xr_a%dG2`#}qH$^!Cs7&D{!jgr#|ZZNBDtsBPvg z_Nt&1p_v;K@kQ2qQnhQU1v;-W5|jF#zA+BvF;*V1Oi>RB*gtXaY7001m6 B_51(; literal 0 HcmV?d00001 diff --git a/packages/server/src/images/process-image-handler.spec.ts b/packages/server/src/images/process-image-handler.spec.ts index 027ee58..174778f 100644 --- a/packages/server/src/images/process-image-handler.spec.ts +++ b/packages/server/src/images/process-image-handler.spec.ts @@ -9,6 +9,7 @@ import { describe, expect, it } from "bun:test"; import { processImageHandler } from "./process-image-handler"; const fixture = Bun.file("../../fixtures/image.jpeg"); +const avifFixture = Bun.file("../../fixtures/image.avif"); describe("/process", () => { it("should process a single image", async () => { @@ -147,6 +148,29 @@ describe("/process", () => { ]); }); + it("should convert avif to avif", async () => { + const opts: RemoteImageOptions = { + format: "avif", + }; + const response = await processImageHandler( + new Request(`http://localhost:3000/images/process`, { + method: "POST", + body: avifFixture, + headers: { "X-Options": JSON.stringify(opts) }, + }) + ); + + expect(response.status).toBe(200); + const collected = await collectResponse(response); + + expect(collected).toEqual([ + { position: 0 }, + { progress: 0 }, + expect.objectContaining({ filename: "file1.avif", type: "image/avif" }), + { progress: 100 }, + ]); + }); + it("should not stream back, if output is provided", async () => { const opts: RemoteImageOptions = { format: "avif",