The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Cloudflare from "@alchemy.run/cloudflare"; |
| 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 { MinimumLogLevel } from "effect/References"; |
| 6 | import { roundTrip } from "./fixtures/counter-client.ts"; |
| 7 | import DomainCounterWorker from "./fixtures/eu-worker.ts"; |
| 8 | |
| 9 | const { test } = Test.make({ |
| 10 | providers: Cloudflare.providers(), |
| 11 | dev: true, |
| 12 | }); |
| 13 | |
| 14 | const logLevel = Effect.provideService(MinimumLogLevel, process.env.DEBUG ? "Debug" : "Info"); |
| 15 | |
| 16 | /** |
| 17 | * Local workerd does not implement Durable Object jurisdictions, so under |
| 18 | * `alchemy dev` `layerDurableObjects({ jurisdiction: "eu" })` runs the model |
| 19 | * unrestricted, as a D1 database, R2 bucket or Queue with a jurisdiction does. |
| 20 | * Every kind of object, and the workflow engine, must still work. |
| 21 | */ |
| 22 | test.provider( |
| 23 | "a Domain model declared with an EU jurisdiction runs in alchemy dev", |
| 24 | (stack) => |
| 25 | Effect.gen(function* () { |
| 26 | yield* stack.destroy(); |
| 27 | const { worker } = yield* stack.deploy( |
| 28 | Effect.gen(function* () { |
| 29 | return { worker: yield* DomainCounterWorker }; |
| 30 | }), |
| 31 | ); |
| 32 | expect(worker.url).toMatch(/^http:\/\/localhost:\d+$/); |
| 33 | yield* roundTrip(worker.url!); |
| 34 | yield* stack.destroy(); |
| 35 | }).pipe(logLevel), |
| 36 | { timeout: 180_000, tags: ["provider:cloudflare", "provider:cloudflare:worker", "local"] }, |
| 37 | ); |