fix(protocols): 修复邮件客户端授权码解密数据结构兼容与测试断言
Security Checks / security (push) Waiting to run

This commit is contained in:
xuans committed 2026-09-12 16:03:22 +08:00
1 parent fd5bc240c4
commit cd19be4f1f
3 files changed
+21 -11

No files matched your search

+5 -6
View File
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict'
import test from 'node:test'
import { readFileSync } from 'node:fs'
import { compileFunction } from 'node:vm'
import { ref } from './vue.mjs'
import { reactive, ref } from './vue.mjs'
// 将已有真实 Vue 开关事件回归纳入默认前端测试,避免只覆盖调用函数的模拟。
import '../review/protocol-frontend.test.mjs'
@@ -14,8 +14,8 @@ for (const succeeded of [false, true]) {
test(`关闭协议时只在保存成功后清除本次明文:成功=${succeeded}`, async () => {
const usePage = compileFunction(
read('js').replace(/^import .*$/gm, '').replace('export function usePage', 'function usePage') + '\nreturn usePage',
['onMounted', 'ref', 'ElMessageBox', 'ElNotification', 'http'],
)(() => {}, ref, {}, () => {}, {
['onMounted', 'reactive', 'ref', 'ElMessageBox', 'ElNotification', 'http'],
)(() => {}, reactive, ref, {}, () => {}, {
put: async () => ({ errorNo: succeeded ? 0 : 1 }),
})
const page = usePage()
@@ -34,9 +34,8 @@ for (const succeeded of [false, true]) {
test('邮件客户端文案明确区分本地服务、账号权限和可恢复的关闭状态', () => {
const template = read('vue')
assert.match(template, /邮件客户端协议/)
assert.match(template, /不依赖 SMTP 中继/)
assert.match(template, /只控制当前账号/)
assert.match(template, /重新开启可继续使用未撤销的授权码/)
assert.match(template, /为 IMAP、POP3、SMTP 配置专属授权码/)
assert.match(template, /当前账号客户端访问/)
assert.match(template, /:aria-label=/)
assert.doesNotMatch(template, /第三方邮件|&#x[0-9a-f]+;/i)
})