@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, 07:15 UTC

main
ts 51 lines 1.97 KB
Raw
1 import * as Cloudflare from "@alchemy.run/cloudflare";
2 import { describe, expect } from "@alchemy.run/test";
3 import * as Test from "@alchemy.run/test/Alchemy";
4 import * as Provider from "alchemy/Provider";
5 import * as Effect from "effect/Effect";
6 import { MinimumLogLevel } from "effect/References";
7 const { test } = Test.make({ providers: Cloudflare.providers() });
8
9 const logLevel = Effect.provideService(MinimumLogLevel, process.env.DEBUG ? "Debug" : "Info");
10
11 describe(
12 "Tunnel Configuration",
13 { tags: ["provider:cloudflare", "provider:cloudflare:tunnel", "live"] },
14 () => {
15 // Canonical `list()` test (parent fan-out singleton): the configuration is a
16 // per-tunnel document with no account-wide enumeration API, so `list()`
17 // enumerates every cfd_tunnel in the account and reads each tunnel's config.
18 // Deploy a tunnel + configuration, then assert the deployed tunnel appears in
19 // the listed result.
20 test.provider(
21 "list enumerates configurations across all tunnels",
22 (stack) =>
23 Effect.gen(function* () {
24 yield* stack.destroy();
25
26 const deployed = yield* stack.deploy(
27 Effect.gen(function* () {
28 const tunnel = yield* Cloudflare.Tunnel.Tunnel("ListTunnel", {
29 configSrc: "cloudflare",
30 });
31 const config = yield* Cloudflare.Tunnel.Configuration("ListConfig", {
32 tunnelId: tunnel.tunnelId,
33 ingress: [
34 { hostname: "config-list-test.internal", service: "http://localhost:8080" },
35 ],
36 });
37 return { tunnelId: tunnel.tunnelId, config };
38 }),
39 );
40
41 const provider = yield* Provider.findProvider(Cloudflare.Tunnel.Configuration);
42 const all = yield* provider.list();
43
44 expect(all.some((c) => c.tunnelId === deployed.tunnelId)).toBe(true);
45
46 yield* stack.destroy();
47 }).pipe(logLevel),
48 { timeout: 180_000 },
49 );
50 },
51 );