fix(deploy): unify backend URL policy
This commit is contained in:
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user