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

main
ts 50 lines 1.8 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 * as pathe from "pathe";
6 import { expectUrlContains } from "../../Cloudflare/Utils/Http.ts";
7 import { assertSiteGone, cloudRunUrl, liveOptions, logLevel, serviceIdentity } from "./site.ts";
8
9 const { test } = Test.make({ providers: GCP.providers() });
10
11 // Built in place: vinext and its RSC toolchain resolve only from the
12 // example's own node_modules (build output is gitignored there).
13 const rootDir = pathe.resolve(import.meta.dirname, "../../../../../examples/fly-website-vinext");
14
15 test.provider(
16 "Vinext: deploy, GET page and env-backed API route, destroy, gone",
17 (stack) =>
18 Effect.gen(function* () {
19 yield* stack.destroy();
20
21 const deployed = yield* stack.deploy(
22 Effect.gen(function* () {
23 const site = yield* GCP.Website.Vinext("Web", {
24 rootDir,
25 memo: {
26 include: ["app/**", "public/**", "package.json", "vite.config.ts", "tsconfig.json"],
27 },
28 env: { GREETING: "Hello from vinext on Cloud Run!" },
29 });
30 return { site };
31 }),
32 );
33
34 const url = deployed.site.url as string;
35 expect(url).toMatch(cloudRunUrl);
36 const service = serviceIdentity(deployed.site.service!);
37 yield* expectUrlContains(`${url}/`, "Hello from vinext on Fly!", {
38 timeout: "180 seconds",
39 label: "vinext page",
40 });
41 yield* expectUrlContains(`${url}/api/hello?name=Alchemy`, "Hello from vinext on Cloud Run!", {
42 timeout: "30 seconds",
43 label: "vinext api env",
44 });
45
46 yield* stack.destroy();
47 yield* assertSiteGone(service);
48 }).pipe(logLevel),
49 liveOptions(1_200_000),
50 );