- Added pnpm-workspace.yaml to define package structure. - Created prepare-local-env.py script for local environment setup. - Introduced tsconfig.json for TypeScript configuration. - Added turbo.json for task management with Turbo.
18 lines
728 B
TypeScript
18 lines
728 B
TypeScript
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
|
|
import { readServerEnvironment } from "./env-schema";
|
|
|
|
test("el puerto usa un valor local por defecto y acepta los límites válidos", () => {
|
|
assert.equal(readServerEnvironment({}).PORT, 3001);
|
|
assert.equal(readServerEnvironment({ PORT: "1" }).PORT, 1);
|
|
assert.equal(readServerEnvironment({ PORT: "65535" }).PORT, 65535);
|
|
});
|
|
test("el arranque rechaza puertos inválidos sin revelar el valor recibido", () => {
|
|
for (const port of ["", "0", "-1", "65536", "1.5", "secret-value"]) {
|
|
assert.throws(() => readServerEnvironment({ PORT: port }), {
|
|
message: "Invalid server configuration: PORT must be between 1 and 65535",
|
|
});
|
|
}
|
|
});
|