feat: 增强风险规则生成引擎与预算中心页面
后端拆分风险规则生成为解释器、语义分析、本体对齐等子模块, 优化模板执行和流程图生成,完善员工种子数据和导入逻辑,增强 报销单权限策略和草稿持久化,前端新增预算中心视图和趋势图 组件,重构审计页面和风险规则测试对话框交互,完善文档中心 和报销创建页面细节,补充单元测试覆盖。
This commit is contained in:
43
web/tests/sidebar-document-unread-dot.test.mjs
Normal file
43
web/tests/sidebar-document-unread-dot.test.mjs
Normal file
@@ -0,0 +1,43 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import test from 'node:test'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const sidebar = readFileSync(
|
||||
fileURLToPath(new URL('../src/components/layout/SidebarRail.vue', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
const documentInbox = readFileSync(
|
||||
fileURLToPath(new URL('../src/composables/useDocumentCenterInbox.js', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
const documentNewState = readFileSync(
|
||||
fileURLToPath(new URL('../src/utils/documentCenterNewState.js', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
test('sidebar renders a red dot for unread document center rows', () => {
|
||||
assert.match(sidebar, /useDocumentCenterInbox/)
|
||||
assert.match(sidebar, /hasUnread: documentInboxHasUnread/)
|
||||
assert.match(sidebar, /<span v-if="item\.hasNewMessage" class="nav-unread-dot" aria-hidden="true"><\/span>/)
|
||||
assert.match(sidebar, /hasNewMessage: item\.id === 'documents' \? documentInboxHasUnread\.value : false/)
|
||||
assert.match(sidebar, /void refreshDocumentInbox\(\)/)
|
||||
assert.match(sidebar, /startDocumentInboxPolling\(\)/)
|
||||
assert.match(sidebar, /stopDocumentInboxPolling\(\)/)
|
||||
assert.match(sidebar, /\.nav-unread-dot\s*\{[\s\S]*background:\s*#ef4444;/)
|
||||
assert.match(sidebar, /\.rail-collapsed \.nav-unread-dot\s*\{[\s\S]*position:\s*absolute;/)
|
||||
})
|
||||
|
||||
test('document inbox reuses document center viewed-key state', () => {
|
||||
assert.match(documentInbox, /DOCUMENT_VIEWED_KEYS_CHANGE_EVENT/)
|
||||
assert.match(documentInbox, /readViewedDocumentKeys/)
|
||||
assert.match(documentInbox, /countNewDocuments\(documentRows\.value, viewedDocumentKeys\.value\)/)
|
||||
assert.match(documentInbox, /fetchExpenseClaims/)
|
||||
assert.match(documentInbox, /fetchApprovalExpenseClaims/)
|
||||
assert.match(documentInbox, /fetchArchivedExpenseClaims/)
|
||||
assert.match(documentInbox, /window\.addEventListener\(DOCUMENT_VIEWED_KEYS_CHANGE_EVENT, refreshViewedDocumentKeys\)/)
|
||||
assert.match(documentNewState, /export const DOCUMENT_VIEWED_KEYS_CHANGE_EVENT/)
|
||||
assert.match(documentNewState, /window\.dispatchEvent\(new CustomEvent\(DOCUMENT_VIEWED_KEYS_CHANGE_EVENT\)\)/)
|
||||
})
|
||||
Reference in New Issue
Block a user