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

main
ts 79 lines 2.08 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("octane-app");
20 const fixtureEntries = [
21 ".gitignore",
22 "package.json",
23 "octane.config.ts",
24 "vite.config.ts",
25 "index.html",
26 "src",
27 "public",
28 ];
29
30 test.provider(
31 "Octane: deploy, GET page and API route, destroy, gone",
32 (stack) =>
33 Effect.gen(function* () {
34 yield* stack.destroy();
35
36 const rootDir = yield* cloneFixture(fixtureDir, {
37 prefix: "alchemy-octane-gcp-",
38 tempRoot,
39 entries: fixtureEntries,
40 });
41
42 const deployed = yield* stack.deploy(
43 Effect.gen(function* () {
44 const site = yield* GCP.Website.Octane("Web", {
45 rootDir,
46 memo: {
47 include: [
48 "src/**",
49 "public/**",
50 "package.json",
51 "octane.config.ts",
52 "vite.config.ts",
53 "index.html",
54 ],
55 },
56 });
57 return { site };
58 }),
59 );
60
61 const url = deployed.site.url as string;
62 expect(url).toMatch(cloudRunUrl);
63 expect(deployed.site.service).toBeDefined();
64 const service = serviceIdentity(deployed.site.service!);
65
66 yield* expectUrlContains(`${url}/`, "OCTANE_AWS_PAGE_MARKER", {
67 timeout: "180 seconds",
68 label: "Octane /",
69 });
70 yield* expectUrlContains(`${url}/api/hello?echo=roundtrip`, "OCTANE_AWS_API_MARKER", {
71 timeout: "30 seconds",
72 label: "Octane /api/hello?echo=roundtrip",
73 });
74
75 yield* stack.destroy();
76 yield* assertSiteGone(service);
77 }).pipe(logLevel),
78 liveOptions(900_000),
79 );