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

main
ts 48 lines 1.85 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { DBClusterParameterGroup } from "@alchemy.run/aws/RDS/DBClusterParameterGroup";
3 import { expect } from "@alchemy.run/test";
4 import * as Test from "@alchemy.run/test/Alchemy";
5 import * as Provider from "alchemy/Provider";
6 import * as Effect from "effect/Effect";
7
8 const { test } = Test.make({ providers: AWS.providers() });
9
10 // Canonical `list()` test (AWS account/region-scoped collection). Cluster
11 // parameter groups create and delete fast (well within the 240s budget), so we
12 // deploy a real group, resolve the provider via the typed
13 // `Provider.findProvider(DBClusterParameterGroup)` so `list()`'s element type is
14 // the exact `DBClusterParameterGroup["Attributes"]` shape, call it, and assert
15 // the deployed group appears in the exhaustively-paginated result.
16 test.provider(
17 "list enumerates the deployed DB cluster parameter group",
18 (stack) =>
19 Effect.gen(function* () {
20 yield* stack.destroy();
21
22 const group = yield* stack.deploy(
23 Effect.gen(function* () {
24 return yield* DBClusterParameterGroup("ListDBClusterParameterGroup", {
25 dbClusterParameterGroupName: "alchemy-test-dbcpg-list",
26 family: "aurora-postgresql16",
27 description: "Alchemy list() test cluster parameter group",
28 });
29 }),
30 );
31
32 const provider = yield* Provider.findProvider(DBClusterParameterGroup);
33 const all = yield* provider.list();
34
35 expect(Array.isArray(all)).toBe(true);
36 expect(
37 all.some((g) => g.dbClusterParameterGroupName === group.dbClusterParameterGroupName),
38 ).toBe(true);
39
40 for (const g of all) {
41 expect(typeof g.dbClusterParameterGroupName).toBe("string");
42 expect(typeof g.family).toBe("string");
43 }
44
45 yield* stack.destroy();
46 }),
47 { tags: ["provider:aws", "provider:aws:rds", "live"] },
48 );