@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 93 lines 3.21 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
9 const { test } = Test.make({ providers: Hetzner.providers(), dev: true });
10
11 /**
12 * SolidStart 2's dev SSR does not run under Bun (`srvx/node` writes
13 * `[object Object]`). Body assertions stay gated; identity (localhost,
14 * no cloud rows) is asserted unconditionally. Set
15 * `ALCHEMY_TEST_SOLIDSTART_DEV_SSR=1` to run the body assertions on a
16 * Node-hosted sidecar.
17 */
18 const runDevSsr = process.env.ALCHEMY_TEST_SOLIDSTART_DEV_SSR === "1";
19
20 const fixtureDir = pathe.resolve(import.meta.dirname, "../../AWS/Website/fixtures/solidstart-app");
21 const tempRoot = pathe.resolve(import.meta.dirname, "../../../.tmp");
22 const fixtureEntries = [".gitignore", "package.json", "vite.config.ts", "src", "public"];
23
24 describe(
25 "Hetzner.Website.SolidStart local",
26 { tags: ["provider:hetzner", "provider:hetzner:website", "local"] },
27 () => {
28 test.provider(
29 "dev runs the framework server with no cloud resources",
30 (stack) =>
31 Effect.gen(function* () {
32 yield* stack.destroy();
33
34 const rootDir = yield* cloneFixture(fixtureDir, {
35 prefix: "alchemy-solidstart-hetzner-local-",
36 tempRoot,
37 entries: fixtureEntries,
38 });
39
40 const deployed = yield* stack.deploy(
41 Effect.gen(function* () {
42 const site = yield* Hetzner.Website.SolidStart("Web", { rootDir });
43 return { site };
44 }),
45 );
46
47 const url = deployed.site.url;
48 expect(url).toMatch(/^http:\/\/(localhost|127\.0\.0\.1):\d+\/?$/);
49 expect(deployed.site.service).toBeUndefined();
50 expect(deployed.site.server).toBeUndefined();
51
52 yield* stack.destroy();
53 }),
54 { timeout: 120_000 },
55 );
56
57 test.provider.skipIf(!runDevSsr)(
58 "dev serves SSR home and API routes",
59 (stack) =>
60 Effect.gen(function* () {
61 yield* stack.destroy();
62
63 const rootDir = yield* cloneFixture(fixtureDir, {
64 prefix: "alchemy-solidstart-hetzner-local-ssr-",
65 tempRoot,
66 entries: fixtureEntries,
67 });
68
69 const deployed = yield* stack.deploy(
70 Effect.gen(function* () {
71 const site = yield* Hetzner.Website.SolidStart("Web", { rootDir });
72 return { site };
73 }),
74 );
75
76 const url = deployed.site.url;
77 yield* expectUrlContains(`${url}/`, "SOLIDSTART_AWS_PAGE_MARKER", {
78 timeout: "90 seconds",
79 label: "dev home page",
80 });
81 yield* expectUrlContains(`${url}/api/hello?echo=roundtrip`, "SOLIDSTART_AWS_API_MARKER", {
82 label: "api route (dev)",
83 });
84 yield* expectUrlContains(`${url}/prerendered`, "SOLIDSTART_AWS_PRERENDERED_MARKER", {
85 label: "extra route (dev)",
86 });
87
88 yield* stack.destroy();
89 }),
90 { timeout: 120_000 },
91 );
92 },
93 );