- 新增 PDF 文档支持,包括格式校验和完整性检查 - 扩展 Word、TXT 和 ZIP 格式附件处理能力 - 添加 Excel 附件可选择仅作为业务文件不解析行数据 - 实现业务助手表格布局配置新增库存和预算字段 - 集成通知、反馈通知等新的业务助手动作类型 - 完善部门管理包含父级部门和排序字段支持 - 增强业务规则校验涵盖更多系统管理场景 - 优化附件上传限制提示信息更准确 - 添加生成文件下载的安全性校验机制 - 扩展测试覆盖确保各业务动作规则正确性
19 lines
1.2 KiB
JavaScript
19 lines
1.2 KiB
JavaScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { assistantFileError, assistantSheetSelection, assistantAttachmentSource } from '../../src/utils/business-assistant.js'
|
|
|
|
test('business PDFs and supplementary file types are supported without accepting executable pages', () => {
|
|
for (const extension of ['pdf', 'doc', 'docx', 'txt', 'zip', 'xlsx', 'png']) assert.equal(assistantFileError({ name: `资料.${extension}`, size: 10 }), '')
|
|
for (const extension of ['html', 'exe', 'js', 'svg']) assert.notEqual(assistantFileError({ name: `资料.${extension}`, size: 10 }), '')
|
|
})
|
|
|
|
test('explicit original-file mode does not add workbook rows to AI import limit', () => {
|
|
const file = { id: 'file-1', name: '报价.xlsx', type: 'excel', asBusinessFile: true, sheets: [{ index: 0, name: '总表', rowCount: 501 }] }
|
|
const selection = assistantSheetSelection([file])
|
|
assert.equal(selection.valid, true)
|
|
assert.equal(selection.rowCount, 0)
|
|
assert.deepEqual(selection.selections, [{ id: 'file-1', fileOnly: true }])
|
|
assert.match(assistantAttachmentSource(file), /不解析工作表/)
|
|
assert.equal(assistantSheetSelection([{ ...file, asBusinessFile: false, selectedSheetIndexes: [0] }]).valid, false)
|
|
})
|