完成全项目响应式审核与换机交接

This commit is contained in:
2026-07-22 07:41:27 +08:00
parent a127280ce6
commit eced3d1e6e
77 changed files with 2052 additions and 378 deletions
+19
View File
@@ -0,0 +1,19 @@
const assert = require("assert");
const fs = require("fs");
const vm = require("vm");
const filename = "utils/validation.js";
const source = `${fs.readFileSync(filename, "utf8")
.replace(/export const /g, "const ")}\nmodule.exports = { PASSWORD_POLICY_MESSAGE, validatePassword };`;
const sandbox = { module: { exports: {} } };
vm.runInNewContext(source, sandbox, { filename });
const { validatePassword } = sandbox.module.exports;
for (const value of ["", "abc1234", "abcdefgh", "12345678", "a".repeat(33) + "1"]) {
assert.equal(validatePassword(value).valid, false, `${value || "empty"} must fail`);
}
for (const value of ["abc12345", "Family2026!"]) {
assert.equal(validatePassword(value).valid, true, `${value} must pass`);
}
console.log("PASSWORD-POLICY-RUNTIME-SMOKE PASS");