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

main
ts 63 lines 1.78 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 { cloneFixture } from "../../Cloudflare/Utils/Fixture.ts";
7 import { expectUrlContains } from "../../Cloudflare/Utils/Http.ts";
8 import {
9 assertSiteGone,
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 = pathe.resolve(
20 import.meta.dirname,
21 "../../../../../examples/cloudflare-website-vocs",
22 );
23 const fixtureEntries = ["package.json", "public", "src", "tsconfig.json", "vocs.config.ts"];
24
25 test.provider(
26 "Vocs: deploy, GET /, destroy, gone",
27 (stack) =>
28 Effect.gen(function* () {
29 yield* stack.destroy();
30
31 const rootDir = yield* cloneFixture(fixtureDir, {
32 prefix: "alchemy-vocs-gcp-",
33 tempRoot,
34 entries: fixtureEntries,
35 });
36
37 const deployed = yield* stack.deploy(
38 Effect.gen(function* () {
39 const site = yield* GCP.Website.Vocs("Web", {
40 rootDir,
41 memo: {
42 include: ["src/**", "public/**", "package.json", "tsconfig.json", "vocs.config.ts"],
43 },
44 });
45 return { site };
46 }),
47 );
48
49 const url = deployed.site.url as string;
50 expect(url).toMatch(cloudRunUrl);
51 expect(deployed.site.service).toBeDefined();
52 const service = serviceIdentity(deployed.site.service!);
53
54 yield* expectUrlContains(`${url}/`, "Alchemy with Vocs", {
55 timeout: "180 seconds",
56 label: "Vocs /",
57 });
58
59 yield* stack.destroy();
60 yield* assertSiteGone(service);
61 }).pipe(logLevel),
62 liveOptions(900_000),
63 );