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
| 1 | import * as GCP from "@alchemy.run/gcp"; |
| 2 | import { describe, 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 | |
| 9 | const { test } = Test.make({ providers: GCP.providers(), dev: true }); |
| 10 | |
| 11 | const fixtureDir = pathe.resolve(import.meta.dirname, "../../Cloudflare/Website/foldkit-fixture"); |
| 12 | const tempRoot = pathe.resolve(import.meta.dirname, "../../../.tmp"); |
| 13 | const fixtureEntries = ["index.html", "package.json", "vite.config.ts", "src"]; |
| 14 | |
| 15 | describe( |
| 16 | "GCP.Website.Foldkit local", |
| 17 | { tags: ["provider:gcp", "provider:gcp:website", "local"] }, |
| 18 | () => { |
| 19 | test.provider( |
| 20 | "dev runs the framework server with no cloud resources", |
| 21 | (stack) => |
| 22 | Effect.gen(function* () { |
| 23 | yield* stack.destroy(); |
| 24 | |
| 25 | const rootDir = yield* cloneFixture(fixtureDir, { |
| 26 | prefix: "alchemy-foldkit-gcp-local-", |
| 27 | tempRoot, |
| 28 | entries: fixtureEntries, |
| 29 | }); |
| 30 | |
| 31 | const deployed = yield* stack.deploy( |
| 32 | Effect.gen(function* () { |
| 33 | const site = yield* GCP.Website.Foldkit("Web", { |
| 34 | rootDir, |
| 35 | }); |
| 36 | return { site }; |
| 37 | }), |
| 38 | ); |
| 39 | |
| 40 | const url = deployed.site.url; |
| 41 | expect(url).toMatch(/^http:\/\/(localhost|127\.0\.0\.1):\d+\/?$/); |
| 42 | expect(deployed.site.service).toBeUndefined(); |
| 43 | |
| 44 | yield* expectUrlContains(`${url}/`, "Foldkit Fixture", { |
| 45 | timeout: "90 seconds", |
| 46 | label: "dev home page", |
| 47 | }); |
| 48 | yield* expectUrlContains(`${url}/counter/42`, "Foldkit Fixture", { |
| 49 | label: "spa fallback", |
| 50 | }); |
| 51 | |
| 52 | yield* stack.destroy(); |
| 53 | }), |
| 54 | { |
| 55 | tags: ["provider:gcp", "provider:gcp:website", "live"], |
| 56 | timeout: 120_000, |
| 57 | }, |
| 58 | ); |
| 59 | }, |
| 60 | ); |