The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 03:37 UTC
| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | |
| 3 | import { |
| 4 | managedEndpointHostname, |
| 5 | isManagedEndpointHostname, |
| 6 | relayOwnsManagedEndpointZone, |
| 7 | } from "./deploymentConfig.ts"; |
| 8 | |
| 9 | describe("relayOwnsManagedEndpointZone", () => { |
| 10 | it("keeps the shared Cloudflare zone owned by production", () => { |
| 11 | expect(relayOwnsManagedEndpointZone("prod")).toBe(true); |
| 12 | expect(relayOwnsManagedEndpointZone("dev_julius")).toBe(false); |
| 13 | }); |
| 14 | }); |
| 15 | |
| 16 | describe("managed endpoint names", () => { |
| 17 | it("keeps the DNS label within the provider limit for long stage names", () => { |
| 18 | const hostname = managedEndpointHostname( |
| 19 | "dev_" + "x".repeat(100), |
| 20 | "example.com", |
| 21 | "a".repeat(64), |
| 22 | ); |
| 23 | |
| 24 | expect(hostname.split(".")[0]?.length).toBeLessThanOrEqual(63); |
| 25 | expect(hostname).toMatch(/-a{16}\.example\.com$/); |
| 26 | }); |
| 27 | |
| 28 | it("rejects hostnames outside the relay zone", () => { |
| 29 | expect(isManagedEndpointHostname("internal.example.net", "example.com")).toBe(false); |
| 30 | expect(isManagedEndpointHostname("example.com.attacker.test", "example.com")).toBe(false); |
| 31 | expect(isManagedEndpointHostname("dev-julius.example.com.", "example.com")).toBe(false); |
| 32 | }); |
| 33 | }); |