fix(deploy): unify backend URL policy

This commit is contained in:
2026-07-12 00:54:39 +02:00
parent a3a266fd81
commit ebdd3aa2c5
10 changed files with 138 additions and 20 deletions
+7
View File
@@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import { backendBaseUrl, joinBackendPath, resolveBackendUrl } from "./runtime-config";
import cases from "./backend-url-cases.json";
describe("resolveBackendUrl", () => {
it("uses the runtime-injected backend URL", () => {
@@ -28,6 +29,12 @@ describe("resolveBackendUrl", () => {
expect(resolveBackendUrl({ backendBaseUrl })).toBe(backendBaseUrl);
},
);
it.each(cases)("applies the canonical policy to $value", ({ value, valid }) => {
const resolve = () => resolveBackendUrl({ backendBaseUrl: value });
if (valid) expect(resolve()).toBe(value);
else expect(resolve).toThrow(/BACKEND_BASE_URL/);
});
});
describe("joinBackendPath", () => {