完成五人团队正式内用最小收口(07-18-small-team-internal-readiness)

这个提交包含在:
2026-07-18 15:46:14 +08:00
父节点 58c8decef9
当前提交 5d0a5f9a38
共修改 134 个文件,包含 10790 行新增和 1413 行删除
@@ -0,0 +1,40 @@
import assert from "node:assert/strict";
import test from "node:test";
import { validateLoopbackHttpUrl, validateTcpPort } from "../validate-loopback-url.mjs";
for (const [input, expected] of [
["http://127.0.0.1:5178", "http://127.0.0.1:5178"],
["http://localhost:3000/", "http://localhost:3000"],
["http://[::1]:4173", "http://[::1]:4173"],
]) {
test(`accepts loopback origin ${input}`, () => {
assert.equal(validateLoopbackHttpUrl(input), expected);
});
}
for (const input of ["1", "80", "5178", "65535"]) {
test(`accepts canonical TCP port ${input}`, () => {
assert.equal(validateTcpPort(input), input);
});
}
for (const input of ["", "0", "065", "65536", "5178/path", "[email protected]", "1.5", "-1"]) {
test(`rejects ambiguous or invalid TCP port ${input || "<empty>"}`, () => {
assert.throws(() => validateTcpPort(input));
});
}
for (const input of [
"https://127.0.0.1:5178",
"http://example.invalid:5178",
"http://localhost.example.invalid:5178",
"http://[email protected]:5178",
"http://remote.invalid@localhost:5178",
"http://user:[email protected]:5178",
"http://127.0.0.1:5178/path",
"not-a-url",
]) {
test(`rejects non-loopback or ambiguous target ${input}`, () => {
assert.throws(() => validateLoopbackHttpUrl(input));
});
}