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

main
ts 36 lines 1.19 KB
Raw
1 import { expect } from "bun:test";
2 import * as Cloudflare from "@alchemy.run/cloudflare";
3 import * as Test from "@alchemy.run/test/Bun";
4 import * as Alchemy from "alchemy";
5 import * as Effect from "effect/Effect";
6 import Stack from "../alchemy.run.ts";
7 import { frameworks } from "../frameworks.ts";
8
9 const { test, beforeAll, afterAll, deploy, destroy } = Test.make({
10 providers: Cloudflare.providers(),
11 profile: process.env.ALCHEMY_PROFILE,
12 });
13 const stack = beforeAll(
14 Effect.sync(Test.defaultStage).pipe(
15 Effect.flatMap((stage) => Alchemy.destroy({ stack: Stack, stage })),
16 Effect.andThen(deploy(Stack)),
17 ),
18 { timeout: 120_000 },
19 );
20 afterAll.skipIf(!!process.env.NO_DESTROY)(destroy(Stack));
21
22 for (const { name, marker } of frameworks) {
23 test(
24 `${name}: the deployed Gateway serves its private Website`,
25 Effect.gen(function* () {
26 const { gatewayUrl } = (yield* stack)[name]!;
27 expect(gatewayUrl).toBeString();
28 const response = yield* Test.getWhenReady(String(gatewayUrl), {
29 times: 8,
30 });
31 expect(response.status).toBe(200);
32 expect(yield* response.text).toContain(marker);
33 }).pipe(Effect.timeout("60 seconds")),
34 { timeout: 65_000 },
35 );
36 }