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.
This commit is contained in:
Xiangzhe
2026-08-13 15:51:28 -03:00
parent 0f73d4e432
commit 0dbc44121f

View File

@@ -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 /"));
});