Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
12345678910111213141516171819202122232425import { describe, expect, it } from "vitest";import { resolveConfig } from "#lib/server/config.ts";
const fosterKnotUrl = (foster?: string) => resolveConfig({ FOSTER_KNOT_URL: foster }).fosterKnotUrl;
describe("resolveConfig fosterKnotUrl", () => { it("parses a bare-origin url into the knot origin, ignoring a trailing slash", () => { expect(fosterKnotUrl("https://foster.test")).toBe("foster.test"); expect(fosterKnotUrl("https://foster.test/")).toBe("foster.test"); expect(fosterKnotUrl("http://127.0.0.1:5555")).toBe("127.0.0.1:5555"); });
it("is empty when unset or blank", () => { expect(fosterKnotUrl()).toBe(""); expect(fosterKnotUrl(" ")).toBe(""); });
it.each(["https://foster.test/foster", "foster.test"])( "rejects %s at config load instead of quietly routing reads to the origin", (url) => { expect(() => fosterKnotUrl(url)).toThrow(/FOSTER_KNOT_URL/); } );});