Backend modules from tastefully 8bd93d15: core-libs, core-session, api-gateway, mobile-api, services-auth, services-system, services-counter, services-member, services-log, services-email. solvway-admin-portal from babyboo f64d096ea, solvway-customer-portal from tastefully 8bd93d15. Copied as tracked files only. Literal secrets replaced with environment placeholders: - services-email: SMTP_PASSWORD, MAILGUN_API_KEY, SENDGRID_API_KEY, MAILJET_API_KEY, MAILJET_SECRET_KEY (optional, empty default) - services-system: JUMIO_TOKEN, JUMIO_SECRET (optional) - services-auth: USER_AUTH_API_SECRET (required); commented JWT secret removed - core-libs: JWT_TOKEN default removed (required), XXL_JOB_TOKEN default removed, ipgeolocation key read from IPGEOLOCATION_API_KEY - services-system EkycAppConfig: commented Jumio credentials removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
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);
|
|
});
|
|
});
|