// The three ways to get something built — yourself, with a partner, by the // studio — are one list (config/build-paths.ts), and every door a newcomer // meets ends in it. Pinned here: the list is exactly those three and each // points at a real address; /build is public and names the site the person // came from without trusting it; the landing page and the final CTA carry the // doors; the tour's "Get this for your site" and the widget's "made with" // line both land on /build; and no "Start a project" sends a newcomer to // sign-IN (it did, on six marketing pages, for months). // Run: npx tsx scripts/test/build-paths.ts import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import { BUILD_PAGE, BUILD_PATHS, buildPageHref, fromHost } from "@/config/build-paths"; import { COMMISSION } from "@/config/commission"; import { ROUTES } from "@/config/auth"; import { STUDIO_DOORS } from "@/lib/widget-chat/concierge"; // ---- the list ---- assert.deepEqual( BUILD_PATHS.map((p) => p.id), ["yourself", "partner", "studio"], "three ways, in the order a person would try them", ); const byId = Object.fromEntries(BUILD_PATHS.map((p) => [p.id, p])); assert.equal( byId.yourself.href, ROUTES.SIGN_UP, "doing it yourself starts at sign-up, not sign-in", ); assert.equal( byId.partner.href, "https://bitbaum.orangecat.ch/builders/", "the partner directory is the one list, on bitbaum", ); assert.equal( byId.studio.href, COMMISSION.studioHireUrl, "hiring the studio is the commission config's address", ); for (const p of BUILD_PATHS) { for (const field of ["title", "body", "cta"] as const) assert.ok(p[field].trim(), `${p.id}.${field}`); assert.ok(!/\bsats?\b|crypto/i.test(p.body), "house words"); } // ---- /build and the link to it ---- assert.equal(BUILD_PAGE.path, "/build"); assert.equal( buildPageHref("https://loki.test", "heidi.orangecat.ch"), "https://loki.test/build?from=heidi.orangecat.ch", ); assert.equal( buildPageHref("https://loki.test", "https://heidi.orangecat.ch/de/situations/x"), "https://loki.test/build?from=heidi.orangecat.ch", "an origin or a URL is reduced to its host", ); assert.equal(buildPageHref("https://loki.test", null), "https://loki.test/build"); assert.equal( buildPageHref("https://loki.test", "