import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; const architecturePath = new URL('../../docs/architecture/system-architecture.md', import.meta.url); const standardsPath = new URL('../../docs/governance/code-development-standards.md', import.meta.url); test('系统架构固定 MySQL 5.7.x 系列、字符集与排序规则', async () => { const architecture = await readFile(architecturePath, 'utf8'); assert.match(architecture, /MySQL 5\.7\.x/); assert.doesNotMatch(architecture, /MySQL 5\.7\.42/); assert.match(architecture, /utf8mb4/); assert.match(architecture, /utf8mb4_general_ci/); }); test('开发规范覆盖 MySQL 5.7.x 全链路兼容性要求', async () => { const standards = await readFile(standardsPath, 'utf8'); for (const requiredText of [ 'MySQL 5.7.x', 'utf8mb4', 'utf8mb4_general_ci', '公用表表达式', '窗口函数', '函数索引', 'utf8mb4_0900_', '不区分大小写', '索引长度', '迁移脚本', '代码 Review', ]) { assert.ok(standards.includes(requiredText), `开发规范缺少数据库基线:${requiredText}`); } assert.doesNotMatch(standards, /MySQL 5\.7\.42/); });