test: tighten hostname normalization coverage

This commit is contained in:
Peter Steinberger
2026-03-14 01:02:20 +00:00
parent 2351caa9cf
commit 89e52d6178

View File

@@ -4,10 +4,12 @@ import { normalizeHostname } from "./hostname.js";
describe("normalizeHostname", () => {
it("trims, lowercases, and strips a trailing dot", () => {
expect(normalizeHostname(" Example.COM. ")).toBe("example.com");
expect(normalizeHostname(" ")).toBe("");
});
it("unwraps bracketed ipv6 hosts after normalization", () => {
expect(normalizeHostname(" [FD7A:115C:A1E0::1] ")).toBe("fd7a:115c:a1e0::1");
expect(normalizeHostname(" [FD7A:115C:A1E0::1]. ")).toBe("fd7a:115c:a1e0::1");
});
it("leaves non-fully-bracketed values otherwise unchanged", () => {