mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-26 16:06:16 +00:00
fix: clear typecheck backlog
This commit is contained in:
@@ -328,13 +328,14 @@ describe("BlueBubbles webhook monitor", () => {
|
||||
}
|
||||
|
||||
function createHangingWebhookRequest(url = "/bluebubbles-webhook?password=test-password") {
|
||||
const req = new EventEmitter() as IncomingMessage & { destroy: ReturnType<typeof vi.fn> };
|
||||
const req = new EventEmitter() as IncomingMessage;
|
||||
const destroyMock = vi.fn();
|
||||
req.method = "POST";
|
||||
req.url = url;
|
||||
req.headers = {};
|
||||
req.destroy = vi.fn();
|
||||
req.destroy = destroyMock as unknown as IncomingMessage["destroy"];
|
||||
setRequestRemoteAddress(req, "127.0.0.1");
|
||||
return req;
|
||||
return { req, destroyMock };
|
||||
}
|
||||
|
||||
function registerWebhookTargets(
|
||||
@@ -415,7 +416,7 @@ describe("BlueBubbles webhook monitor", () => {
|
||||
setupWebhookTarget();
|
||||
|
||||
// Create a request that never sends data or ends (simulates slow-loris)
|
||||
const req = createHangingWebhookRequest();
|
||||
const { req, destroyMock } = createHangingWebhookRequest();
|
||||
|
||||
const res = createMockResponse();
|
||||
|
||||
@@ -427,7 +428,7 @@ describe("BlueBubbles webhook monitor", () => {
|
||||
const handled = await handledPromise;
|
||||
expect(handled).toBe(true);
|
||||
expect(res.statusCode).toBe(408);
|
||||
expect(req.destroy).toHaveBeenCalled();
|
||||
expect(destroyMock).toHaveBeenCalled();
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
@@ -436,7 +437,7 @@ describe("BlueBubbles webhook monitor", () => {
|
||||
it("rejects unauthorized requests before reading the body", async () => {
|
||||
const account = createMockAccount({ password: "secret-token" });
|
||||
setupWebhookTarget({ account });
|
||||
const req = createHangingWebhookRequest("/bluebubbles-webhook?password=wrong-token");
|
||||
const { req } = createHangingWebhookRequest("/bluebubbles-webhook?password=wrong-token");
|
||||
const onSpy = vi.spyOn(req, "on");
|
||||
await expectWebhookStatus(req, 401);
|
||||
expect(onSpy).not.toHaveBeenCalledWith("data", expect.any(Function));
|
||||
|
||||
Reference in New Issue
Block a user