@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 71 lines 2.18 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/react-router-app",
14 );
15 const tempRoot = pathe.resolve(import.meta.dirname, "../../../.tmp");
16 const fixtureEntries = [
17 ".gitignore",
18 "package.json",
19 "react-router.config.ts",
20 "vite.config.ts",
21 "app",
22 "public",
23 ];
24
25 describe(
26 "Railway.Website.ReactRouter local",
27 { tags: ["provider:railway", "provider:railway:website", "local"] },
28 () => {
29 test.provider(
30 "dev runs the framework server with no cloud resources",
31 (stack) =>
32 Effect.gen(function* () {
33 yield* stack.destroy();
34
35 const rootDir = yield* cloneFixture(fixtureDir, {
36 prefix: "alchemy-react-router-railway-local-",
37 tempRoot,
38 entries: fixtureEntries,
39 });
40
41 const deployed = yield* stack.deploy(
42 Effect.gen(function* () {
43 const site = yield* Railway.Website.ReactRouter("Web", {
44 rootDir,
45 });
46 return { site };
47 }),
48 );
49
50 const url = deployed.site.url;
51 expect(url).toMatch(/^http:\/\/(localhost|127\.0\.0\.1):\d+\/?$/);
52 expect(deployed.site.service).toBeUndefined();
53 expect(deployed.site.project).toBeUndefined();
54
55 const origin = String(url).replace(/\/+$/, "");
56 yield* expectUrlContains(`${origin}/`, "REACT_ROUTER_AWS_PAGE_MARKER", {
57 timeout: "90 seconds",
58 label: "dev home page",
59 });
60 yield* expectUrlContains(
61 `${origin}/api/hello?echo=roundtrip`,
62 "REACT_ROUTER_AWS_API_MARKER",
63 { label: "api route (dev)" },
64 );
65
66 yield* stack.destroy();
67 }),
68 { timeout: 120_000 },
69 );
70 },
71 );