import { describe, it, expect } from "vitest"; import { bodyLimit, DEFAULT_BODY_LIMIT, UPLOAD_BODY_LIMIT } from "./bodyLimit"; // bounded-request-bodies (F40): the portal refuses an API write whose declared body exceeds its route's limit. describe("bodyLimit", () => { it("allows uploads more room than ordinary writes", () => { expect(bodyLimit("/api/auth/login")).toBe(DEFAULT_BODY_LIMIT); expect(bodyLimit("/api/member/profile")).toBe(DEFAULT_BODY_LIMIT); for (const upload of [ "/api/products/image", "/api/member/reviews/images", "/api/member/kyc/upload", "/api/email-templates/attachments", "/api/admin/kyc/abc/doc/ID_FRONT", "/api/refunds/abc/photos/0", "/api/locations/invoice-header", "/api/fulfilment/import", "/api/email-templates", "/api/email-templates/preview", "/api/messages/import", "/api/products/import/validate", ]) { expect(bodyLimit(upload)).toBe(UPLOAD_BODY_LIMIT); } }); it("uses 1 MB and 10 MB", () => { expect(DEFAULT_BODY_LIMIT).toBe(1024 * 1024); expect(UPLOAD_BODY_LIMIT).toBe(10 * 1024 * 1024); }); });