cmvr-wms/ruoyi-ui-vue3/tests/unit/notice-management-entry.test.mjs
lixiaolong 966df3ed57 feat(app): 添加消息中心功能并优化AI助手体验
- 集成消息中心屏幕和未读消息徽章显示
- 实现消息中心后台轮询和应用状态监听
- 添加应用启动时的消息刷新逻辑
- 更新导航标题配置增加消息中心选项
- 在助手界面改进报价更正说明显示
- 增强AI助手报价单处理和文档识别功能
- 添加管理员消息发送权限控制和验证
- 优化采购参考价格操作的业务规则说明
- 修复AI助手权限验证中的通知操作检查
2026-10-20 13:39:44 +08:00

23 lines
1.5 KiB
JavaScript

import test from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
test('message center offers a keyboard-accessible, permission-gated announcement management entry even when empty', () => {
const source = readFileSync(new URL('../../src/layout/components/HeaderNotice/index.vue', import.meta.url), 'utf8')
assert.match(source, /@click="openCenter"/)
assert.match(source, /<button[^>]*aria-label="消息中心"/)
assert.match(source, /v-if="proxy\?\.\$can\(\['system:notice:list'\]\)" class="center-footer"/)
assert.match(source, />公告管理<\/el-button>/)
assert.match(source, /if \(!proxy\.\$can\(\['system:notice:list'\]\)\) return/)
assert.match(source, /router\.push\('\/system\/notice'\)/)
assert.doesNotMatch(source, /notice-footer[^>]*noticeList\.length/)
})
test('notice management keeps native create, update and delete permission gates', () => {
const source = readFileSync(new URL('../../src/views/system/notice/index.vue', import.meta.url), 'utf8')
for (const permission of ['add', 'edit', 'remove']) assert.ok(source.includes(`$can(['system:notice:${permission}'])`))
const navbar = readFileSync(new URL('../../src/layout/components/Navbar.vue', import.meta.url), 'utf8')
const beforeNotice = navbar.slice(0, navbar.indexOf('<header-notice'))
assert.ok(beforeNotice.lastIndexOf('</template>') > beforeNotice.lastIndexOf(`appStore.device !== 'mobile'`), 'The notice entry must not disappear on mobile')
})