cmvr-wms/ruoyi-ui-vue3/tests/unit/business-assistant-loading.test.mjs
lixiaolong a82258561b feat(auth): 添加认证cookie名称配置并优化表单布局
- 在 .env.production 中新增 VITE_AUTH_COOKIE_NAME 配置项用于设置认证cookie名称
- 将 AcceptanceException.vue 中的表单标签宽度从固定90px改为自动适配
- 在 ActionDialog.vue 中将多个表单项标记为必填项并调整标签宽度为自动适配
- 重构 ActionHistory.vue 中的按钮布局结构并添加表格列样式类名
- 更新 api-contract-audit.cjs 添加生产任务和BOM相关接口的契约测试
- 修改 auth.js 使用动态认证cookie键名替换硬编码的Admin-Token
- 调整系统角色授权用户页面的表单布局和表格样式类名
- 优化 ReceiptDialog Batch 组件的对话框尺寸、表单验证和分页功能
2026-10-16 15:30:10 +08:00

28 lines
1.7 KiB
JavaScript

import test from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { assistantSessionLoadingCopy } from '../../src/utils/assistant-loading.js'
test('loading explains permissions and recent conversations without invented progress', () => {
assert.match(assistantSessionLoadingCopy(0), /操作权限和最近对话/)
assert.equal(assistantSessionLoadingCopy(7999), assistantSessionLoadingCopy(0))
assert.match(assistantSessionLoadingCopy(8000), /响应比平时慢/)
assert.match(assistantSessionLoadingCopy(20000), /等待服务器响应/)
assert.match(assistantSessionLoadingCopy(90000), /先收起助手/)
for (const ms of [0, 8000, 20000, 90000]) assert.doesNotMatch(assistantSessionLoadingCopy(ms), /完成|成功|%|即将/)
})
test('preparing screen replaces stale recovery and action controls without artificial delays', () => {
const main = readFileSync(new URL('../../src/components/BusinessAssistant/index.vue', import.meta.url), 'utf8')
assert.match(main, /<assistant-session-loading v-if="sessionLoading"/)
assert.match(main, /canOperateDraft && !sessionLoading && !resumePrompt/)
assert.match(main, /assistant.needsRefresh && !sessionLoading && !resumePrompt/)
assert.match(main, /v-if="allowed && !sessionLoading && !resumePrompt" class="business-assistant-composer"/)
assert.doesNotMatch(main, /正在核对权限并恢复会话/)
const loading = readFileSync(new URL('../../src/components/BusinessAssistant/AssistantSessionLoading.vue', import.meta.url), 'utf8')
assert.match(loading, /role="status" aria-live="polite"/)
assert.match(loading, /prefers-reduced-motion/)
assert.match(loading, /clearInterval\(timer\)/)
assert.doesNotMatch(loading, /setTimeout|Math\.random/)
})