@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, 04:45 UTC

main
ts 39 lines 1.4 KB
Raw
1 import * as Cloudflare from "@alchemy.run/cloudflare";
2 import * as Test from "@alchemy.run/test/Alchemy";
3 import * as Effect from "effect/Effect";
4 import { exerciseSqlSurface } from "./exercise.ts";
5 import Stack from "./fixtures/d1-stack.ts";
6
7 const { test, beforeAll, afterAll, deploy, destroy } = Test.make({
8 providers: Cloudflare.providers(),
9 state: Cloudflare.state(),
10 });
11
12 const HOOK_TIMEOUT = 300_000;
13 const TEST_TIMEOUT = 120_000;
14
15 /**
16 * End-to-end test of `SQL.D1` — the raw `@effect/sql-d1` client wrapped in
17 * alchemy's deferred `proxyChain` — against a real Cloudflare Worker + D1
18 * database. The shared exercise drives every `SqlClient` constructor helper
19 * the D1 driver supports (transactions and `updateValues` are not supported
20 * by `@effect/sql-d1`); because the client is proxyChain-wrapped, every
21 * nested helper (`sql.insert`, `sql.and`, `sql.in`, `sql.csv`, identifiers)
22 * also regression-tests deferred-proxy replay.
23 */
24 const stack = beforeAll(deploy(Stack), { timeout: HOOK_TIMEOUT });
25 afterAll.skipIf(!!process.env.NO_DESTROY)(destroy(Stack), {
26 timeout: HOOK_TIMEOUT,
27 });
28
29 test(
30 "SQL.D1 exercises the full client surface over a deployed Worker",
31 Effect.gen(function* () {
32 const { url } = yield* stack;
33 yield* exerciseSqlSurface(url);
34 }),
35 {
36 tags: ["provider:cloudflare", "provider:cloudflare:d1", "provider:cloudflare:worker", "live"],
37 timeout: TEST_TIMEOUT,
38 },
39 );