mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-20 05:31:30 +00:00
17 lines
695 B
TypeScript
17 lines
695 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { createMockIncomingRequest } from "../../../test/helpers/mock-incoming-request.js";
|
|
import { readLineWebhookRequestBody } from "./webhook-node.js";
|
|
|
|
describe("readLineWebhookRequestBody", () => {
|
|
it("reads body within limit", async () => {
|
|
const req = createMockIncomingRequest(['{"events":[{"type":"message"}]}']);
|
|
const body = await readLineWebhookRequestBody(req, 1024);
|
|
expect(body).toContain('"events"');
|
|
});
|
|
|
|
it("rejects oversized body", async () => {
|
|
const req = createMockIncomingRequest(["x".repeat(2048)]);
|
|
await expect(readLineWebhookRequestBody(req, 128)).rejects.toThrow("PayloadTooLarge");
|
|
});
|
|
});
|