@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 64 lines 1.88 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("astro-app");
20 const fixtureEntries = [".gitignore", "package.json", "astro.config.mjs", "src", "public"];
21
22 test.provider(
23 "Astro SSR: deploy, GET / and an API route, destroy, gone",
24 (stack) =>
25 Effect.gen(function* () {
26 yield* stack.destroy();
27
28 const rootDir = yield* cloneFixture(fixtureDir, {
29 prefix: "alchemy-astro-gcp-",
30 tempRoot,
31 entries: fixtureEntries,
32 });
33
34 const deployed = yield* stack.deploy(
35 Effect.gen(function* () {
36 const site = yield* GCP.Website.Astro("Web", {
37 rootDir,
38 memo: {
39 include: ["src/**", "public/**", "package.json", "astro.config.mjs"],
40 },
41 });
42 return { site };
43 }),
44 );
45
46 const url = deployed.site.url as string;
47 expect(url).toMatch(cloudRunUrl);
48 expect(deployed.site.service).toBeDefined();
49 const service = serviceIdentity(deployed.site.service!);
50
51 yield* expectUrlContains(`${url}/`, "ASTRO_AWS_PAGE_MARKER", {
52 timeout: "180 seconds",
53 label: "Astro /",
54 });
55 yield* expectUrlContains(`${url}/api/hello?echo=roundtrip`, "ASTRO_AWS_API_MARKER", {
56 timeout: "30 seconds",
57 label: "Astro /api/hello?echo=roundtrip",
58 });
59
60 yield* stack.destroy();
61 yield* assertSiteGone(service);
62 }).pipe(logLevel),
63 liveOptions(900_000),
64 );