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

main
ts 53 lines 1.62 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { Group } from "@alchemy.run/aws/IAM";
3 import { expect } from "@alchemy.run/test";
4 import * as Test from "@alchemy.run/test/Alchemy";
5 import * as IAM from "@distilled.cloud/aws/iam";
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 test.provider(
12 "list enumerates the deployed group",
13 (stack) =>
14 Effect.gen(function* () {
15 yield* stack.destroy();
16
17 const group = yield* stack.deploy(
18 Effect.gen(function* () {
19 return yield* Group("ListGroup", {
20 groupName: "alchemy-test-group-list",
21 inlinePolicies: {
22 SupportReadOnly: {
23 Version: "2012-10-17",
24 Statement: [
25 {
26 Effect: "Allow",
27 Action: ["cloudwatch:Get*", "cloudwatch:List*"],
28 Resource: ["*"],
29 },
30 ],
31 },
32 },
33 });
34 }),
35 );
36
37 const provider = yield* Provider.findProvider(Group);
38 const all = yield* provider.list();
39
40 const found = all.find((g) => g.groupName === group.groupName);
41 expect(found).toBeDefined();
42 expect(found?.groupArn).toBe(group.groupArn);
43 expect(found?.inlinePolicies.SupportReadOnly).toBeDefined();
44
45 yield* stack.destroy();
46
47 const deleted = yield* IAM.getGroup({
48 GroupName: group.groupName,
49 }).pipe(Effect.option);
50 expect(deleted._tag).toBe("None");
51 }),
52 { tags: ["provider:aws", "provider:aws:iam", "live"] },
53 );