| 1 | import * as Website from "@/Neon/Website/index.ts"; |
| 2 | import { expect, it } from "alchemy-test"; |
| 3 | |
| 4 | const constructors = [ |
| 5 | "Vite", |
| 6 | "Astro", |
| 7 | "Nextjs", |
| 8 | "Nuxt", |
| 9 | "SvelteKit", |
| 10 | "ReactRouter", |
| 11 | "SolidStart", |
| 12 | "TanStackStart", |
| 13 | "Waku", |
| 14 | "Octane", |
| 15 | "Foldkit", |
| 16 | "Vocs", |
| 17 | "StaticSite", |
| 18 | ] as const; |
| 19 | const contracts = [ |
| 20 | () => |
| 21 | Website.Vite("Web", { |
| 22 | vite: { outDir: "build", base: "/docs/" }, |
| 23 | assets: { notFoundHandling: "single-page-application" }, |
| 24 | }), |
| 25 | () => Website.Astro("Web", { astro: { output: "static" } }), |
| 26 | () => |
| 27 | Website.Nextjs("Web", { |
| 28 | project: { projectId: "project" }, |
| 29 | function: { name: "Web", slug: "website" }, |
| 30 | }), |
| 31 | () => Website.Nuxt("Web", { nuxt: { app: { baseURL: "/docs/" } } }), |
| 32 | () => Website.SvelteKit("Web", { kit: { paths: { base: "/docs" } } }), |
| 33 | () => Website.Waku("Web", { waku: { srcDir: "src" } }), |
| 34 | () => Website.Foldkit("Web"), |
| 35 | () => Website.Octane("Web"), |
| 36 | () => Website.ReactRouter("Web"), |
| 37 | () => Website.SolidStart("Web"), |
| 38 | () => Website.TanStackStart("Web"), |
| 39 | () => Website.Vocs("Docs"), |
| 40 | () => |
| 41 | Website.StaticSite("Web", { |
| 42 | command: "hugo", |
| 43 | outdir: "public", |
| 44 | branch: { projectId: "project", branchId: "branch" }, |
| 45 | }), |
| 46 | () => |
| 47 | Website.Vite("Web", { |
| 48 | branch: { projectId: "project", branchId: "branch" }, |
| 49 | // @ts-expect-error Branch and project are mutually exclusive scopes. |
| 50 | project: { projectId: "project" }, |
| 51 | }), |
| 52 | () => |
| 53 | Website.Vite("Web", { |
| 54 | // @ts-expect-error The composition owns its entrypoint. |
| 55 | function: { main: "./index.ts" }, |
| 56 | }), |
| 57 | () => |
| 58 | Website.Astro("Web", { |
| 59 | // @ts-expect-error Memory sizing is not exposed by Neon Functions. |
| 60 | function: { memory: 512 }, |
| 61 | }), |
| 62 | () => |
| 63 | Website.Nextjs("Web", { |
| 64 | // @ts-expect-error Functions export Fetch handlers; they do not expose listening ports. |
| 65 | function: { port: 3000 }, |
| 66 | }), |
| 67 | () => |
| 68 | Website.Vite("Web", { |
| 69 | // @ts-expect-error SPA behavior belongs in assets.notFoundHandling. |
| 70 | spa: true, |
| 71 | }), |
| 72 | ]; |
| 73 | |
| 74 | it( |
| 75 | "exports all thirteen constructors with restricted Neon deployment controls", |
| 76 | () => { |
| 77 | for (const name of constructors) |
| 78 | expect(typeof Website[name]).toBe("function"); |
| 79 | expect(contracts.length).toBeGreaterThan(constructors.length); |
| 80 | }, |
| 81 | { tags: ["unit", "provider:neon", "provider:neon:website", "local"] }, |
| 82 | ); |