@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 62 lines 2.35 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { Connection } from "@alchemy.run/aws/CodeConnections/Connection";
3 import { expect } from "@alchemy.run/test";
4 import * as Test from "@alchemy.run/test/Alchemy";
5 import * as codeconnections from "@distilled.cloud/aws/codeconnections";
6 import * as Provider from "alchemy/Provider";
7 import * as Effect from "effect/Effect";
8
9 const { test } = Test.make({ providers: AWS.providers() });
10
11 // Connection names are capped at 32 chars.
12 const connectionName = "alchemy-test-conn";
13
14 test.provider(
15 "lifecycle: create GitHub connection (PENDING), destroy",
16 (stack) =>
17 Effect.gen(function* () {
18 yield* stack.destroy();
19
20 // Create — the connection is created in PENDING; completing the OAuth
21 // handshake is a manual console step with no API, so PENDING is the
22 // only state we can assert without human interaction.
23 const deployed = yield* stack.deploy(
24 Effect.gen(function* () {
25 return yield* Connection("GitHubConn", {
26 connectionName,
27 providerType: "GitHub",
28 });
29 }),
30 );
31 expect(deployed.connectionArn).toContain(":connection/");
32 expect(deployed.connectionStatus).toBe("PENDING");
33 expect(deployed.providerType).toBe("GitHub");
34
35 // Out-of-band verification via distilled.
36 const created = yield* codeconnections.getConnection({
37 ConnectionArn: deployed.connectionArn,
38 });
39 expect(created.Connection?.ConnectionName).toBe(connectionName);
40 expect(created.Connection?.ConnectionStatus).toBe("PENDING");
41 expect(created.Connection?.ProviderType).toBe("GitHub");
42
43 // Canonical list() coverage.
44 const provider = yield* Provider.findProvider(Connection);
45 const all = yield* provider.list();
46 expect(all.some((c) => c.connectionArn === deployed.connectionArn)).toBe(true);
47
48 // Destroy — connection is deleted; verify it is gone out-of-band.
49 yield* stack.destroy();
50 const after = yield* codeconnections
51 .getConnection({ ConnectionArn: deployed.connectionArn })
52 .pipe(
53 Effect.map((res) => res.Connection),
54 Effect.catchTag("ResourceNotFoundException", () => Effect.succeed(undefined)),
55 );
56 expect(after).toBeUndefined();
57 }),
58 {
59 tags: ["provider:aws", "provider:aws:codeconnections", "live"],
60 timeout: 120_000,
61 },
62 );