Files
X-Financial/web/tests/steward-plan-message-copy.test.mjs
caoxiaozhu ee730aa31c feat(web): AI 工作台文件预览/附件关联任务与草稿分支
- 新增 WorkbenchAiFilePreviewDialog 附件预览对话框及 useWorkbenchAiFilePreview,附件支持点击预览
- 新增 attachmentAssociationJobs/linkedReimbursementDraftJobs 前端服务与对应 composable,接入后台任务轮询与状态展示
- 新增 travelReimbursementDraftBranchModel 草稿分支模型,报销关联门控支持跳过/选择草稿
- PersonalWorkbenchAiMode 及各 composable(expense/document/steward/application-preview/attachment-association)重构适配,WorkbenchAiComposer/FileStrip 样式与交互完善
- DocumentsCenter/ReceiptFolder/TravelReimbursementCreate 等视图及 scripts 重构,风险/差旅规划/审批等工具适配
- 新增/更新前端测试:application-result-card、reimbursement-list-preview-fetch、guided-flow、composer-components 等
2026-06-24 10:42:50 +08:00

74 lines
2.6 KiB
JavaScript

import assert from 'node:assert/strict'
import test from 'node:test'
import {
buildStewardPlanMessageText,
buildStewardSuggestedActions
} from '../src/views/scripts/stewardPlanModel.js'
test('steward plan summary uses warm guidance copy for application flow', () => {
const message = buildStewardPlanMessageText({
tasks: [
{
task_id: 'task-1',
task_type: 'expense_application',
title: '费用申请 差旅',
assigned_agent: 'application_assistant',
confirmation_required: true
}
],
next_action: 'confirm_create_application'
})
assert.match(message, /我先帮您把步骤理清楚/)
assert.match(message, /我先看了一下,您这次主要是 \*\*1 个事项\*\*/)
assert.match(message, /为了不让步骤混在一起/)
assert.match(message, /这步交给申请助手——先把申请单草稿拉出来给您过目/)
assert.match(message, /您看这个顺序是否合适/)
assert.match(message, /需要补充的信息会在具体步骤里再温和提醒/)
assert.doesNotMatch(message, /我会这样推进/)
assert.doesNotMatch(message, /不会一次性把所有动作都执行掉/)
assert.doesNotMatch(message, /交给申请助手生成申请单核对结果/)
})
test('steward plan summary guides bare reimbursement intent into scene selection', () => {
const plan = {
tasks: [
{
task_id: 'task-reim-1',
task_type: 'reimbursement',
title: '费用报销 1',
assigned_agent: 'reimbursement_assistant',
confirmation_required: true,
ontology_fields: {
expense_type: 'other',
reason: '我要报销'
},
missing_fields: ['time_range', 'reason']
}
],
confirmation_groups: [
{
confirmation_id: 'confirm-task-reim-1',
action_type: 'confirm_create_reimbursement_draft',
target_task_id: 'task-reim-1'
}
],
next_action: 'confirm_task'
}
const message = buildStewardPlanMessageText(plan)
assert.match(message, /我来带您发起报销/)
assert.match(message, /您现在只说了要报销/)
assert.match(message, /先选报销场景/)
assert.match(message, /差旅费、交通费、住宿费/)
assert.doesNotMatch(message, /步骤混在一起/)
assert.doesNotMatch(message, /核对“费用报销 1”/)
const [action] = buildStewardSuggestedActions(plan)
assert.equal(action.label, '确定,选择报销场景')
assert.match(action.description, /先进入报销助手选择具体费用类型/)
assert.equal(action.payload.carry_text, '我要报销')
})