feat(expenses): backfill historical claims into expense cases
This commit is contained in:
@@ -100,6 +100,64 @@ test('expense case timeline gives returned events an actionable reason', () => {
|
||||
assert.equal(timeline.events[0].summary, '住宿票据缺少入住人信息')
|
||||
})
|
||||
|
||||
test('expense case timeline explains a historical import without pretending it is a business action', () => {
|
||||
const timeline = buildExpenseCaseTimelineViewModel({
|
||||
events: [
|
||||
{
|
||||
id: 'historical-import-1',
|
||||
event_type: 'historical_claim_imported',
|
||||
actor_id: 'migration-worker',
|
||||
actor_type: 'user',
|
||||
occurred_at: '2026-07-14T03:00:00Z',
|
||||
correlation_id: 'private-correlation',
|
||||
delivery_status: 'pending',
|
||||
payload_json: {
|
||||
reason: '不应覆盖历史导入事件的专用说明',
|
||||
next_status: 'submitted',
|
||||
next_approval_stage: '直属领导审批',
|
||||
migration_batch_id: 'private-batch',
|
||||
source_table: 'expense_claims'
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const [event] = timeline.events
|
||||
assert.equal(event.label, '历史单据已纳入统一费用事件')
|
||||
assert.equal(event.icon, 'mdi mdi-history')
|
||||
assert.equal(event.tone, 'info')
|
||||
assert.equal(event.actorLabel, '系统')
|
||||
assert.equal(
|
||||
event.summary,
|
||||
'系统已根据原单据建立费用事件档案。纳入时状态:已提交 · 纳入时节点:直属领导审批。导入前办理记录以原单据为准,后续动作将在此持续记录。'
|
||||
)
|
||||
assert.doesNotMatch(
|
||||
JSON.stringify(event),
|
||||
/不应覆盖|private-correlation|pending|private-batch|expense_claims/
|
||||
)
|
||||
})
|
||||
|
||||
test('expense case timeline keeps the historical import summary honest when state is missing', () => {
|
||||
const timeline = buildExpenseCaseTimelineViewModel({
|
||||
events: [
|
||||
{
|
||||
id: 'historical-import-without-state',
|
||||
event_type: 'historical_claim_imported',
|
||||
actor_id: 'system',
|
||||
occurred_at: '2026-07-14T03:00:00Z',
|
||||
payload_json: {}
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const [event] = timeline.events
|
||||
assert.equal(
|
||||
event.summary,
|
||||
'系统已根据原单据建立费用事件档案。导入前办理记录以原单据为准,后续动作将在此持续记录。'
|
||||
)
|
||||
assert.doesNotMatch(event.summary, /纳入时状态|纳入时节点|undefined|null/)
|
||||
})
|
||||
|
||||
test('expense case timeline describes application archive against the paid reimbursement', () => {
|
||||
const timeline = buildExpenseCaseTimelineViewModel({
|
||||
events: [
|
||||
|
||||
Reference in New Issue
Block a user