authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 00:25:45-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 00:25:45-07:00
logac93fbfad01ecd99f818d9964463afb6c35a8f4a
tree74253ab55b10273978c9559de0a0f6e8463b9394
parentba873b8181c3741603a365e75785457064a52ffd
signature Signed by PGP key B5690EEEBB952194

test(relay): keep the stage slug helper private (#9998)


2 files changed, 1 insertions(+), 8 deletions(-)

infra/relay/src/deploymentConfig.test.ts-7
...@@ -11,17 +11,10 @@ import {...@@ -11,17 +11,10 @@ import {
11 RelayPublicDomainLabelTooLongError,11 RelayPublicDomainLabelTooLongError,
12 relayPublicDomainForStage,12 relayPublicDomainForStage,
13 relayResourceNameForStage,13 relayResourceNameForStage,
14 relayStageSlug,
15} from "./deploymentConfig.ts";14} from "./deploymentConfig.ts";
1615
17const isRelayPublicDomainLabelTooLongError = Schema.is(RelayPublicDomainLabelTooLongError);16const isRelayPublicDomainLabelTooLongError = Schema.is(RelayPublicDomainLabelTooLongError);
1817
19describe("relayStageSlug", () => {
20 it("matches Alchemy physical-name sanitization for default developer stages", () => {
21 expect(relayStageSlug("dev_julius")).toBe("dev-julius");
22 });
23});
24
25describe("relayPublicDomainForStage", () => {18describe("relayPublicDomainForStage", () => {
26 it("uses the canonical relay hostname for production", () => {19 it("uses the canonical relay hostname for production", () => {
27 expect(relayPublicDomainForStage("prod", ".example.com.")).toBe("relay.example.com");20 expect(relayPublicDomainForStage("prod", ".example.com.")).toBe("relay.example.com");
infra/relay/src/deploymentConfig.ts+1-1
...@@ -56,7 +56,7 @@ function appendDnsSafeSuffix(prefix: string, suffix: string): string {...@@ -56,7 +56,7 @@ function appendDnsSafeSuffix(prefix: string, suffix: string): string {
56 * Alchemy's physical-name helper sanitizes resource names after adding the56 * Alchemy's physical-name helper sanitizes resource names after adding the
57 * stage. Keep custom domains and runtime-created resources aligned with it.57 * stage. Keep custom domains and runtime-created resources aligned with it.
58 */58 */
59export function relayStageSlug(stage: string): string {59function relayStageSlug(stage: string): string {
60 return stage60 return stage
61 .toLowerCase()61 .toLowerCase()
62 .replaceAll(/[^a-z0-9-]/g, "-")62 .replaceAll(/[^a-z0-9-]/g, "-")