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

main
ts 31 lines 1.15 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 Console from "effect/Console";
5 import * as Effect from "effect/Effect";
6 import Stack from "../alchemy.run.ts";
7
8 const { test, beforeAll, afterAll, deploy, destroy } = Test.make({
9 providers: Cloudflare.providers(),
10 state: Cloudflare.state(),
11 });
12
13 const stack = beforeAll(deploy(Stack).pipe(Effect.tap(Console.log)));
14 afterAll.skipIf(!!process.env.NO_DESTROY)(destroy(Stack));
15
16 test(
17 "serves the TanStack Start Solid app shell",
18 Effect.gen(function* () {
19 const { websiteUrl } = yield* stack;
20
21 // `HttpClient.get` resolves successfully even on the fresh-deploy 404, so a
22 // plain `Effect.retry` never fires — `Test.getWhenReady` fails on the
23 // cold-start window and retries until the route serves the real app.
24 const res = yield* Test.getWhenReady(websiteUrl);
25 expect(res.status).toBe(200);
26 const html = yield* res.text;
27 expect(html).toContain("TanStack Start Solid");
28 expect(html).toContain("Hello from TanStack Start Solid on Cloudflare.Website.Vite");
29 }),
30 { timeout: 180_000 },
31 );