cmvr-wms/ruoyi-ui-vue3/tests/unit/feedback-notification.test.mjs

29 lines
1.5 KiB
JavaScript
Raw Normal View History

import assert from 'node:assert/strict'
import test from 'node:test'
import { readFileSync } from 'node:fs'
const read = name => readFileSync(new URL(`../../src/components/UserFeedback/${name}.vue`, import.meta.url), 'utf8')
test('recipient settings and notification details remain administrator-only, outside menus', () => {
const source = read('index')
assert.match(source, /<el-tab-pane v-if="canManage" label="通知设置"/)
assert.match(source, /<NotificationDetail v-if="canManage"/)
assert.match(source, /tab === 'notifications' && canManage/)
assert.match(source, /\['mine', 'all'\]\.includes\(tab.value\)/)
})
test('mail preview is plain text and requires separate explicit send, never an AI-chosen address', () => {
const source = read('NotificationDetail')
assert.match(source, /<pre>\{\{ plan.body \}\}<\/pre>/)
assert.doesNotMatch(source, /v-html|el-dialog/)
assert.match(source, /确认发送邮件/)
assert.match(source, /previewToken: plan.value.previewToken/)
assert.match(source, /retryConfirmed/)
assert.match(source, /onBeforeUnmount\(\(\) => \{ generation\+\+; clearTimeout\(timer\)/)
})
test('roles use current membership and auto-send has a clear opt-in warning', () => {
const source = read('NotificationSettings')
assert.match(source, /roleIds: item.roleIds/)
assert.match(source, /管理员预览后发送/)
assert.match(source, /保存即允许此模块的新反馈自动通知/)
assert.match(source, /不会补发历史反馈/)
assert.match(source, /只有管理员可查看全部反馈/)
})