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

main
ts 62 lines 2.11 KB
Raw
1 import * as Railway from "@alchemy.run/railway";
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: Railway.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 "Railway.Website.TanStackStart local",
20 { tags: ["provider:railway", "provider:railway: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-railway-local-",
30 tempRoot,
31 entries: fixtureEntries,
32 });
33
34 const deployed = yield* stack.deploy(
35 Effect.gen(function* () {
36 const site = yield* Railway.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.project).toBeUndefined();
45
46 const origin = String(url).replace(/\/+$/, "");
47 yield* expectUrlContains(`${origin}/`, "TANSTACK_AWS_PAGE_MARKER", {
48 timeout: "90 seconds",
49 label: "dev home page",
50 });
51 yield* expectUrlContains(
52 `${origin}/api/hello?echo=roundtrip`,
53 "TANSTACK_AWS_API_MARKER",
54 { label: "api route (dev)" },
55 );
56
57 yield* stack.destroy();
58 }),
59 { timeout: 120_000 },
60 );
61 },
62 );