18 lines
643 B
TypeScript
18 lines
643 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { getRequestHostname } from "../lib/admin-routing";
|
|
|
|
describe("admin routing helpers", () => {
|
|
it("prefers the first non-empty forwarded hostname", () => {
|
|
expect(getRequestHostname("root.mohfarawati.de", "internal-service")).toBe("root.mohfarawati.de");
|
|
});
|
|
|
|
it("normalizes ports and comma-separated proxy values", () => {
|
|
expect(getRequestHostname(undefined, "root.mohfarawati.de:443, proxy")).toBe("root.mohfarawati.de");
|
|
});
|
|
|
|
it("falls back to an empty string when no hostname exists", () => {
|
|
expect(getRequestHostname(undefined, null, "")).toBe("");
|
|
});
|
|
});
|