The best way to control Claude Code, Codex and more from any computer or phone
| 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("waku-app"); |
| 20 | const fixtureEntries = [".gitignore", "package.json", "tsconfig.json", "src", "public"]; |
| 21 | |
| 22 | test.provider( |
| 23 | "Waku: deploy, GET page, RSC and SSG routes, destroy, gone", |
| 24 | (stack) => |
| 25 | Effect.gen(function* () { |
| 26 | yield* stack.destroy(); |
| 27 | |
| 28 | const rootDir = yield* cloneFixture(fixtureDir, { |
| 29 | prefix: "alchemy-waku-gcp-", |
| 30 | tempRoot, |
| 31 | entries: fixtureEntries, |
| 32 | }); |
| 33 | |
| 34 | const deployed = yield* stack.deploy( |
| 35 | Effect.gen(function* () { |
| 36 | const site = yield* GCP.Website.Waku("Web", { |
| 37 | rootDir, |
| 38 | memo: { |
| 39 | include: ["src/**", "public/**", "package.json", "tsconfig.json"], |
| 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}/`, "WAKU_AWS_PAGE_MARKER", { |
| 52 | timeout: "180 seconds", |
| 53 | label: "Waku /", |
| 54 | }); |
| 55 | yield* expectUrlContains(`${url}/echo?echo=roundtrip`, "WAKU_AWS_API_MARKER", { |
| 56 | timeout: "30 seconds", |
| 57 | label: "Waku /echo?echo=roundtrip", |
| 58 | }); |
| 59 | yield* expectUrlContains(`${url}/about`, "WAKU_AWS_STATIC_MARKER", { |
| 60 | timeout: "30 seconds", |
| 61 | label: "Waku /about", |
| 62 | }); |
| 63 | |
| 64 | yield* stack.destroy(); |
| 65 | yield* assertSiteGone(service); |
| 66 | }).pipe(logLevel), |
| 67 | liveOptions(900_000), |
| 68 | ); |