| 1 | import * as Prisma from "@/Prisma/index.ts"; |
| 2 | import { expect, it } from "alchemy-test"; |
| 3 | |
| 4 | const constructors = [ |
| 5 | "Astro", |
| 6 | "Foldkit", |
| 7 | "Nextjs", |
| 8 | "Nuxt", |
| 9 | "Octane", |
| 10 | "ReactRouter", |
| 11 | "SolidStart", |
| 12 | "StaticSite", |
| 13 | "SvelteKit", |
| 14 | "TanStackStart", |
| 15 | "Vinext", |
| 16 | "Vite", |
| 17 | "Vocs", |
| 18 | "Waku", |
| 19 | ] as const; |
| 20 | |
| 21 | const contracts = [ |
| 22 | () => |
| 23 | Prisma.Website.Vite("Web", { |
| 24 | vite: { outDir: "build", base: "/docs/" }, |
| 25 | assets: { notFoundHandling: "single-page-application" }, |
| 26 | }), |
| 27 | () => |
| 28 | Prisma.Website.Astro("Blog", { |
| 29 | astro: { output: "server", site: "https://example.com" }, |
| 30 | }), |
| 31 | () => |
| 32 | Prisma.Website.Astro("Docs", { |
| 33 | astro: { output: "static" }, |
| 34 | assets: { notFoundHandling: "404-page" }, |
| 35 | }), |
| 36 | () => Prisma.Website.Nextjs("Web", { rootDir: "./app" }), |
| 37 | () => |
| 38 | Prisma.Website.Vinext("Web", { |
| 39 | rootDir: "./app", |
| 40 | env: { GREETING: "hello" }, |
| 41 | domain: "app.example.com", |
| 42 | memo: false, |
| 43 | dev: { port: 5173 }, |
| 44 | compute: { destroyOldDeployment: true }, |
| 45 | }), |
| 46 | () => Prisma.Website.Nuxt("Web", { nuxt: { app: { baseURL: "/docs/" } } }), |
| 47 | () => Prisma.Website.SvelteKit("Web", { kit: { paths: { base: "/docs" } } }), |
| 48 | () => Prisma.Website.Waku("Web", { waku: { srcDir: "src" } }), |
| 49 | () => Prisma.Website.Foldkit("Web"), |
| 50 | () => Prisma.Website.Octane("Web"), |
| 51 | () => Prisma.Website.ReactRouter("Web"), |
| 52 | () => Prisma.Website.SolidStart("Web"), |
| 53 | () => Prisma.Website.TanStackStart("Web"), |
| 54 | () => Prisma.Website.Vocs("Docs"), |
| 55 | () => |
| 56 | Prisma.Website.StaticSite("Docs", { |
| 57 | command: "bun run build", |
| 58 | outdir: "public", |
| 59 | }), |
| 60 | () => |
| 61 | Prisma.Website.Vite("Web", { |
| 62 | project: Prisma.Project("Parent", { createDatabase: false }), |
| 63 | dev: { mode: "external", url: "http://localhost:5173" }, |
| 64 | }), |
| 65 | () => |
| 66 | Prisma.Website.Vite("Web", { |
| 67 | // @ts-expect-error SPA routing belongs in assets.notFoundHandling. |
| 68 | spa: true, |
| 69 | }), |
| 70 | () => |
| 71 | Prisma.Website.Astro("Web", { |
| 72 | // @ts-expect-error Framework output belongs in the astro option bag. |
| 73 | output: "static", |
| 74 | }), |
| 75 | ]; |
| 76 | |
| 77 | it( |
| 78 | "exports every framework with the established Website prop vocabulary", |
| 79 | () => { |
| 80 | for (const name of constructors) |
| 81 | expect(typeof Prisma.Website[name]).toBe("function"); |
| 82 | expect(contracts.length).toBeGreaterThan(constructors.length); |
| 83 | }, |
| 84 | { |
| 85 | tags: [ |
| 86 | "unit", |
| 87 | "provider:prisma", |
| 88 | "provider:prisma:project", |
| 89 | "provider:prisma:website", |
| 90 | "local", |
| 91 | ], |
| 92 | }, |
| 93 | ); |