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

main
ts 63 lines 2.13 KB
Raw
1 import * as Fly from "@alchemy.run/fly";
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: Fly.providers(), dev: true });
10
11 const fixtureDir = pathe.resolve(
12 import.meta.dirname,
13 "../../AWS/Website/fixtures/tanstack-start-app",
14 );
15 const tempRoot = pathe.resolve(import.meta.dirname, "../../../.tmp");
16 const fixtureEntries = [".gitignore", "package.json", "vite.config.ts", "src", "public"];
17
18 describe(
19 "Fly.Website.TanStackStart local",
20 { tags: ["provider:fly", "provider:fly:website", "local"] },
21 () => {
22 test.provider(
23 "dev runs the framework server with no cloud resources",
24 (stack) =>
25 Effect.gen(function* () {
26 yield* stack.destroy();
27
28 const rootDir = yield* cloneFixture(fixtureDir, {
29 prefix: "alchemy-tanstack-start-fly-local-",
30 tempRoot,
31 entries: fixtureEntries,
32 });
33
34 const deployed = yield* stack.deploy(
35 Effect.gen(function* () {
36 const site = yield* Fly.Website.TanStackStart("Web", { rootDir });
37 return { site };
38 }),
39 );
40
41 const url = deployed.site.url;
42 expect(url).toMatch(/^http:\/\/(localhost|127\.0\.0\.1):\d+\/?$/);
43 expect(deployed.site.service).toBeUndefined();
44 expect(deployed.site.app).toBeUndefined();
45 expect(deployed.site.ip).toBeUndefined();
46
47 const origin = String(url).replace(/\/+$/, "");
48 yield* expectUrlContains(`${origin}/`, "TANSTACK_AWS_PAGE_MARKER", {
49 timeout: "90 seconds",
50 label: "dev home page",
51 });
52 yield* expectUrlContains(
53 `${origin}/api/hello?echo=roundtrip`,
54 "TANSTACK_AWS_API_MARKER",
55 { label: "api route (dev)" },
56 );
57
58 yield* stack.destroy();
59 }),
60 { timeout: 120_000 },
61 );
62 },
63 );