feat: 将工作流与 FAQ 上传上限扩至 20MB
- 同步管理端、用户中心与后端工作流文件校验 - 扩展 FAQ 普通及分享上传限制并补充边界测试
This commit is contained in:
@@ -127,11 +127,21 @@ describe('workflowFileValue', () => {
|
||||
});
|
||||
|
||||
it('上传前校验单文件大小限制', () => {
|
||||
const oversizedFile = new File([new Uint8Array(6 * 1024 * 1024)], 'large.pdf');
|
||||
const acceptedFile = new File(
|
||||
[new Uint8Array(20 * 1024 * 1024)],
|
||||
'accepted.pdf',
|
||||
);
|
||||
const oversizedFile = new File(
|
||||
[new Uint8Array(20 * 1024 * 1024 + 1)],
|
||||
'large.pdf',
|
||||
);
|
||||
|
||||
expect(() =>
|
||||
validateWorkflowFileSelection([], [oversizedFile]),
|
||||
).toThrow('单个文件不能超过 5.0 MB');
|
||||
validateWorkflowFileSelection([], [acceptedFile]),
|
||||
).not.toThrow();
|
||||
expect(() => validateWorkflowFileSelection([], [oversizedFile])).toThrow(
|
||||
'单个文件不能超过 20.0 MB',
|
||||
);
|
||||
});
|
||||
|
||||
it('上传前校验总大小限制', () => {
|
||||
|
||||
@@ -21,7 +21,7 @@ export interface WorkflowResourceLike {
|
||||
|
||||
export const WORKFLOW_FILE_LIMITS = {
|
||||
maxCount: 10,
|
||||
maxSingleSize: 5 * 1024 * 1024,
|
||||
maxSingleSize: 20 * 1024 * 1024,
|
||||
maxTotalSize: 50 * 1024 * 1024,
|
||||
} as const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user