feat: 完善全栈打包质量门禁
在业务开发前补齐 lint、format、verify 与生产运行时契约,确保开发联调和 executable 打包链路可重复验证。
This commit is contained in:
@@ -13,6 +13,10 @@ describe("runtime config", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("环境变量可以覆盖默认端口", () => {
|
||||
expect(readRuntimeConfig([], { PORT: "4100" })).toEqual({ host: "127.0.0.1", port: 4100 });
|
||||
});
|
||||
|
||||
test("支持 inline CLI 参数", () => {
|
||||
expect(readRuntimeConfig(["--host=localhost", "--port=4002"], {})).toEqual({
|
||||
host: "localhost",
|
||||
@@ -22,5 +26,13 @@ describe("runtime config", () => {
|
||||
|
||||
test("拒绝无效端口", () => {
|
||||
expect(() => readRuntimeConfig(["--port", "invalid"], {})).toThrow("无效端口");
|
||||
expect(() => readRuntimeConfig(["--port", "3000.5"], {})).toThrow("无效端口");
|
||||
expect(() => readRuntimeConfig(["--port", "-1"], {})).toThrow("无效端口");
|
||||
expect(() => readRuntimeConfig(["--port", "65536"], {})).toThrow("无效端口");
|
||||
});
|
||||
|
||||
test("接受端口边界值", () => {
|
||||
expect(readRuntimeConfig(["--port", "0"], {})).toEqual({ host: "127.0.0.1", port: 0 });
|
||||
expect(readRuntimeConfig(["--port", "65535"], {})).toEqual({ host: "127.0.0.1", port: 65535 });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user