feat(expenses): add authoritative pre-review workflow

This commit is contained in:
caoxiaozhu
2026-07-16 11:42:08 +08:00
parent ae3f02c35a
commit 6bdf65bc24
52 changed files with 4300 additions and 1069 deletions

View File

@@ -100,6 +100,48 @@ test('expense case timeline gives returned events an actionable reason', () => {
assert.equal(timeline.events[0].summary, '住宿票据缺少入住人信息')
})
test('expense case timeline explains receipt collection, association and AI pre-review', () => {
const timeline = buildExpenseCaseTimelineViewModel({
events: [
{
id: 'receipt-1',
event_type: 'receipt_received',
actor_id: 'employee@example.com',
occurred_at: '2026-07-13T01:00:00Z',
payload_json: { file_name: '上海出差高铁票.pdf' }
},
{
id: 'association-1',
event_type: 'attachment_associated',
actor_id: 'employee@example.com',
occurred_at: '2026-07-13T01:01:00Z',
payload_json: { claim_no: 'BX-20260713-001' }
},
{
id: 'pre-review-1',
event_type: 'claim_pre_review_completed',
actor_id: 'employee@example.com',
occurred_at: '2026-07-13T01:02:00Z',
payload_json: {
passed: false,
blocking_risk_count: 1,
message: '自动检测发现 1 条重大风险,请逐条填写原因后再提交审批。'
}
}
]
})
assert.deepEqual(timeline.events.map((event) => event.label), [
'票据已进入费用事件',
'票据已归集到报销草稿',
'报销单 AI 预审已完成'
])
assert.match(timeline.events[0].summary, /上海出差高铁票\.pdf/)
assert.match(timeline.events[1].summary, /BX-20260713-001/)
assert.equal(timeline.events[2].tone, 'warning')
assert.match(timeline.events[2].summary, /1 条重大风险/)
})
test('expense case timeline explains a historical import without pretending it is a business action', () => {
const timeline = buildExpenseCaseTimelineViewModel({
events: [