@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 77 lines 2.09 KB
Raw
1 import * as GCP from "@alchemy.run/gcp";
2 import { expect } from "@alchemy.run/test";
3 import * as Test from "@alchemy.run/test/Alchemy";
4 import * as Effect from "effect/Effect";
5 import { cloneFixture } from "../../Cloudflare/Utils/Fixture.ts";
6 import { expectUrlContains } from "../../Cloudflare/Utils/Http.ts";
7 import {
8 assertSiteGone,
9 awsFixture,
10 cloudRunUrl,
11 liveOptions,
12 logLevel,
13 serviceIdentity,
14 tempRoot,
15 } from "./site.ts";
16
17 const { test } = Test.make({ providers: GCP.providers() });
18
19 const fixtureDir = awsFixture("react-router-app");
20 const fixtureEntries = [
21 ".gitignore",
22 "package.json",
23 "react-router.config.ts",
24 "vite.config.ts",
25 "app",
26 "public",
27 ];
28
29 test.provider(
30 "ReactRouter: deploy, GET page and API route, destroy, gone",
31 (stack) =>
32 Effect.gen(function* () {
33 yield* stack.destroy();
34
35 const rootDir = yield* cloneFixture(fixtureDir, {
36 prefix: "alchemy-react-router-gcp-",
37 tempRoot,
38 entries: fixtureEntries,
39 });
40
41 const deployed = yield* stack.deploy(
42 Effect.gen(function* () {
43 const site = yield* GCP.Website.ReactRouter("Web", {
44 rootDir,
45 memo: {
46 include: [
47 "app/**",
48 "public/**",
49 "package.json",
50 "react-router.config.ts",
51 "vite.config.ts",
52 ],
53 },
54 });
55 return { site };
56 }),
57 );
58
59 const url = deployed.site.url as string;
60 expect(url).toMatch(cloudRunUrl);
61 expect(deployed.site.service).toBeDefined();
62 const service = serviceIdentity(deployed.site.service!);
63
64 yield* expectUrlContains(`${url}/`, "REACT_ROUTER_AWS_PAGE_MARKER", {
65 timeout: "180 seconds",
66 label: "ReactRouter /",
67 });
68 yield* expectUrlContains(`${url}/api/hello?echo=roundtrip`, "REACT_ROUTER_AWS_API_MARKER", {
69 timeout: "30 seconds",
70 label: "ReactRouter /api/hello?echo=roundtrip",
71 });
72
73 yield* stack.destroy();
74 yield* assertSiteGone(service);
75 }).pipe(logLevel),
76 liveOptions(900_000),
77 );