From 0dbc44121f328f1b02341ce4bf583e0cce1d3926 Mon Sep 17 00:00:00 2001 From: Xiangzhe Date: Thu, 13 Aug 2026 15:51:28 -0300 Subject: [PATCH] test(ocr): align sanitized-500 assert with HR#12 error sanitization The test's own title ("returns a sanitized 500") describes the new behavior mandated by HR#12 (never leak err.message in a response body). The old regex asserted the pre-sanitization leak (`OCR request failed: socket closed`) as expected output, which contradicted its own title and the sanitization this task intentionally introduced in open-sse/handlers/ocr.ts. Scoped to this single assertion only. --- tests/unit/ocr-route.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/ocr-route.test.ts b/tests/unit/ocr-route.test.ts index 5047311c38..31bfc7cffe 100644 --- a/tests/unit/ocr-route.test.ts +++ b/tests/unit/ocr-route.test.ts @@ -183,6 +183,7 @@ test("handleOcr returns a sanitized 500 when the upstream request throws", async const payload = (await response.json()) as any; assert.equal(response.status, 500); - assert.match(payload.error.message, /OCR request failed: socket closed/); + assert.ok(payload.error.message.includes("OCR request failed")); + assert.ok(!payload.error.message.includes("socket closed")); assert.ok(!payload.error.message.includes("at /")); });