Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { getDomainRoutingConfig, hostMatches } from "./routing.js";
|
||||
|
||||
describe("getDomainRoutingConfig non-local subdomain derivation", () => {
|
||||
test("preserves an explicit port when deriving canonical subdomains", () => {
|
||||
expect(getDomainRoutingConfig({ APP_BASE_DOMAIN: "example.com:8443" })).toMatchObject({
|
||||
appBaseDomain: "example.com:8443",
|
||||
webAppHost: "app.example.com:8443",
|
||||
adminAppHost: "admin.example.com:8443",
|
||||
apiHost: "api.example.com:8443",
|
||||
protocol: "https",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("hostMatches edge cases", () => {
|
||||
test("returns false when either host normalizes to nothing", () => {
|
||||
expect(hostMatches(undefined, "app.example.com")).toBe(false);
|
||||
expect(hostMatches("app.example.com", " ")).toBe(false);
|
||||
expect(hostMatches(undefined, undefined)).toBe(false);
|
||||
});
|
||||
|
||||
test("treats local hosts as matching when only one carries a dev port", () => {
|
||||
expect(hostMatches("app.localhost:3000", "app.localhost")).toBe(true);
|
||||
expect(hostMatches("app.localhost", "app.localhost:3000")).toBe(true);
|
||||
});
|
||||
|
||||
test("rejects two local hosts that both pin different dev ports", () => {
|
||||
expect(hostMatches("app.localhost:3000", "app.localhost:4000")).toBe(false);
|
||||
});
|
||||
|
||||
test("rejects local hosts with different hostnames even without ports", () => {
|
||||
expect(hostMatches("app.localhost", "api.localhost")).toBe(false);
|
||||
});
|
||||
|
||||
test("rejects non-equal hosts that are not both local", () => {
|
||||
expect(hostMatches("app.example.com", "app.example.org")).toBe(false);
|
||||
expect(hostMatches("app.localhost:3000", "app.example.com:3000")).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user