Files
X-Financial/web/tests/reimbursementTextInference.test.mjs
caoxiaozhu 002bf4f756 feat: 完善报销单审批流程及退回原因追踪
新增直属领导审批通过接口和审批待办列表查询,报销单退回
支持原因码分类和审批环节标记,优化票据附件去重和路径
回退查找,前端新增退回原因对话框、审批收件箱和工作台
图标组件,补充工具函数和单元测试覆盖。
2026-05-20 21:00:47 +08:00

43 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import assert from 'node:assert/strict'
import test from 'node:test'
import {
buildLocalExtractionProgressMessages,
buildLocalIntentPreview,
inferLocalFlowCandidates,
summarizeSemanticIntentDetail
} from '../src/utils/reimbursementTextInference.js'
const ridingFareMessage = '业务发生时间:2026-03-04送客户去林萃小区办事请报销乘车费用'
test('local flow intent preview names transport expense for riding fare text', () => {
const candidates = inferLocalFlowCandidates(ridingFareMessage)
assert.equal(candidates.time, '2026-03-04')
assert.equal(candidates.event, '交通出行')
assert.equal(candidates.expenseType, '交通费')
assert.match(buildLocalIntentPreview(ridingFareMessage), /交通费/)
assert.ok(
buildLocalExtractionProgressMessages(ridingFareMessage).some(
(item) => item.includes('交通出行') && item.includes('交通费')
)
)
})
test('semantic intent detail includes recognized expense type', () => {
assert.equal(
summarizeSemanticIntentDetail({
scenario: 'expense',
intent: 'draft',
entities_json: [
{
type: 'expense_type',
value: '交通',
normalized_value: 'transport'
}
]
}),
'已识别为报销场景,当前目标是草稿生成,费用类型为交通费'
)
})