47 lines
1.8 KiB
JavaScript
47 lines
1.8 KiB
JavaScript
|
|
import assert from 'node:assert/strict'
|
||
|
|
import test from 'node:test'
|
||
|
|
|
||
|
|
import {
|
||
|
|
buildInlineApplicationDetailAction,
|
||
|
|
buildInlineApplicationPreviewActionResultText
|
||
|
|
} from '../src/composables/workbenchAiMode/workbenchAiApplicationPreviewModel.js'
|
||
|
|
import {
|
||
|
|
AI_APPLICATION_ACTION_SAVE_DRAFT,
|
||
|
|
AI_APPLICATION_ACTION_SUBMIT
|
||
|
|
} from '../src/services/aiApplicationPreviewActions.js'
|
||
|
|
|
||
|
|
const draftPayload = {
|
||
|
|
claim_no: 'AUKSNUCFD',
|
||
|
|
claim_id: 'claim-1001',
|
||
|
|
approval_stage: '直属领导审批',
|
||
|
|
start_date: '2026-02-20',
|
||
|
|
location: '上海辅助国网仿生产服务器',
|
||
|
|
reason: '差旅费用申请'
|
||
|
|
}
|
||
|
|
|
||
|
|
test('application result card stays display-only while the detail shortcut keeps navigation', () => {
|
||
|
|
const resultText = buildInlineApplicationPreviewActionResultText(AI_APPLICATION_ACTION_SUBMIT, {
|
||
|
|
result: { draft_payload: draftPayload }
|
||
|
|
})
|
||
|
|
const [detailAction] = buildInlineApplicationDetailAction(draftPayload)
|
||
|
|
|
||
|
|
assert.match(resultText, /\| 单据类型 \| 单据编号 \| 单据状态 \| 当前节点 \| 日期 \| 地点 \| 事由 \| 金额 \|/)
|
||
|
|
assert.doesNotMatch(resultText, /\| 操作 \|/)
|
||
|
|
assert.doesNotMatch(resultText, /\[查看\]/)
|
||
|
|
assert.doesNotMatch(resultText, /点击卡片.*操作.*查看/)
|
||
|
|
assert.equal(detailAction?.label, '查看单据详情')
|
||
|
|
assert.equal(detailAction?.action_type, 'open_application_detail')
|
||
|
|
assert.equal(detailAction?.payload?.claim_no, 'AUKSNUCFD')
|
||
|
|
})
|
||
|
|
|
||
|
|
test('saved draft result also avoids the duplicate in-card view guidance', () => {
|
||
|
|
const resultText = buildInlineApplicationPreviewActionResultText(AI_APPLICATION_ACTION_SAVE_DRAFT, {
|
||
|
|
result: { draft_payload: draftPayload }
|
||
|
|
})
|
||
|
|
|
||
|
|
assert.match(resultText, /申请草稿已保存/)
|
||
|
|
assert.doesNotMatch(resultText, /\| 操作 \|/)
|
||
|
|
assert.doesNotMatch(resultText, /\[查看\]/)
|
||
|
|
assert.doesNotMatch(resultText, /点击卡片.*操作.*查看/)
|
||
|
|
})
|