Files
OmniRoute/tests/unit/mitm-handler-trae.test.ts
Hernan Javier Ardila Sanchez fd26e601a2 fix(dashboard): use lightweight ping endpoint for MaintenanceBanner (fixes #3040) (#3043)
Integrated into release/v3.8.8. Applied review fixes: moved the SELECT 1 into a pingDb() db helper (no raw SQL in route, Hard Rule #5) + the 503 catch no longer leaks err.message (Hard Rule #12). Thanks @herjarsa!
2026-06-01 14:30:17 -03:00

24 lines
704 B
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import type { IncomingMessage, ServerResponse } from "node:http";
import { TraeHandler } from "../../src/mitm/handlers/trae.ts";
test("trae handler — intercept throws structured error (viability=investigating)", async () => {
const h = new TraeHandler();
const req = {
method: "POST",
url: "/x",
headers: { host: "trae.invalid" },
} as unknown as IncomingMessage;
const res = {
headersSent: false,
writeHead() {},
end() {},
} as unknown as ServerResponse;
await assert.rejects(
() => h.intercept(req, res, Buffer.from("{}"), "gpt-4o"),
/investigation|invalid|not.*implement/i
);
});