@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 69 lines 2.4 KB
Raw
1 import * as Hetzner from "@alchemy.run/hetzner";
2 import { describe, expect } from "@alchemy.run/test";
3 import * as Test from "@alchemy.run/test/Alchemy";
4 import * as Effect from "effect/Effect";
5 import * as pathe from "pathe";
6 import { cloneFixture } from "../../Cloudflare/Utils/Fixture.ts";
7 import { expectUrlContains } from "../../Cloudflare/Utils/Http.ts";
8 import { prepareNextjsFixture } from "../../Cloudflare/Website/TypeScriptCompat.ts";
9
10 const { test } = Test.make({ providers: Hetzner.providers(), dev: true });
11
12 const fixtureDir = pathe.resolve(import.meta.dirname, "../../AWS/Website/fixtures/nextjs-app");
13 const fixtureEntries = [
14 ".gitignore",
15 "package.json",
16 "next.config.ts",
17 "tsconfig.json",
18 "app",
19 "public",
20 ];
21
22 describe(
23 "Hetzner.Website.Nextjs local",
24 { tags: ["provider:hetzner", "provider:hetzner:website", "local"] },
25 () => {
26 test.provider(
27 "dev runs the framework server with no cloud resources",
28 (stack) =>
29 Effect.gen(function* () {
30 yield* stack.destroy();
31
32 // Clone OUTSIDE the repo (OS temp dir): an in-workspace clone makes
33 // Next treat the alchemy monorepo as the workspace root and look up
34 // the root's typescript (catalog:build = tsgo).
35 const rootDir = yield* cloneFixture(fixtureDir, {
36 prefix: "alchemy-nextjs-hetzner-local-",
37 entries: fixtureEntries,
38 });
39 yield* prepareNextjsFixture(rootDir);
40
41 const deployed = yield* stack.deploy(
42 Effect.gen(function* () {
43 const site = yield* Hetzner.Website.Nextjs("Web", { rootDir });
44 return { site };
45 }),
46 );
47
48 const url = deployed.site.url;
49 expect(url).toMatch(/^http:\/\/(localhost|127\.0\.0\.1):\d+\/?$/);
50 expect(deployed.site.service).toBeUndefined();
51 expect(deployed.site.server).toBeUndefined();
52
53 yield* expectUrlContains(`${url}/`, "NEXTJS_AWS_PAGE_MARKER", {
54 timeout: "180 seconds",
55 label: "dev home page",
56 });
57 yield* expectUrlContains(`${url}/api/hello?echo=roundtrip`, "NEXTJS_AWS_API_MARKER", {
58 label: "api route (dev)",
59 });
60 yield* expectUrlContains(`${url}/static`, "NEXTJS_AWS_STATIC_MARKER", {
61 label: "extra route (dev)",
62 });
63
64 yield* stack.destroy();
65 }),
66 { timeout: 600_000 },
67 );
68 },
69 );