import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; const read = (path) => readFile(new URL(path, import.meta.url), 'utf8'); test('问师傅首屏提供政策制度快捷问题且继续走统一 Agent 请求', async () => { const [page, service] = await Promise.all([ read('../src/pages/user/sop/index.vue'), read('../src/services/agent.ts') ]); assert.match(page, /const policyQuickQuestion = '问制度:请说明公司请假和考勤的适用规定'/); assert.match(page, /void sendQuestion\(value\)/); assert.match(service, /\/api\/aihr\/agent\/messages/); assert.doesNotMatch(page, /toolCode:\s*['"]POLICY/); }); test('直通车系统回执明确区分已收到、待处理和人工正式回复', async () => { const page = await read('../src/pages/user/direct/index.vue'); assert.match(page, /已收到,当前状态为“待处理”;可在“我的反馈”查看人工正式回复/); assert.match(page, /item\.status === 'REPLIED' \? '已回复' : '待处理'/); assert.match(page, /正式回复<\/text>/); }); test('内置兜底与管理端演示不宣称帮道自动创建或派发工单', async () => { const [sopSeed, modelSeed, adminDemo] = await Promise.all([ read('../../backend/ruoyi-modules/ruoyi-aihr/src/main/java/org/dromara/aihr/service/AihrSopSeedService.java'), read('../../backend/ruoyi-modules/ruoyi-aihr/src/main/java/org/dromara/aihr/service/AihrModelSeedService.java'), read('../../frontend/src/views/knowledge/sop.vue') ]); const combined = [sopSeed, modelSeed, adminDemo].join('\n'); assert.match(combined, /既有工单系统/); assert.doesNotMatch(combined, /再创建工单/); assert.doesNotMatch(combined, /再生成工单闭环/); assert.match(modelSeed, /当前系统不会代为创建或派发工单/); });