import { describe, expect, it } from "vitest"; import { readServerBinding } from "../../src/settings/server.js"; describe("readServerBinding", () => { it("honors the configured bind host and port", () => { expect(readServerBinding({ HOST: "127.0.0.2", PORT: "9100" })).toEqual({ host: "127.0.0.2", port: 9100, }); }); it.each(["0", "65536", "1.5", "not-a-port"])('rejects invalid PORT="%s"', (port) => { expect(() => readServerBinding({ HOST: "127.0.0.1", PORT: port })).toThrow( "PORT must be an integer between 1 and 65535", ); }); it("rejects a bind URL in place of a host", () => { expect(() => readServerBinding({ HOST: "https://127.0.0.1", PORT: "8788" })).toThrow( "HOST must be a hostname or IP address", ); }); });