@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, 06:00 UTC

main
ts 42 lines 1.19 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { User } 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 user",
13 (stack) =>
14 Effect.gen(function* () {
15 yield* stack.destroy();
16
17 const user = yield* stack.deploy(
18 Effect.gen(function* () {
19 return yield* User("ListUser", {
20 tags: {
21 env: "test",
22 },
23 });
24 }),
25 );
26
27 const provider = yield* Provider.findProvider(User);
28 const all = yield* provider.list();
29
30 const found = all.find((u) => u.userName === user.userName);
31 expect(found).toBeDefined();
32 expect(found?.userArn).toBe(user.userArn);
33
34 yield* stack.destroy();
35
36 const deleted = yield* IAM.getUser({
37 UserName: user.userName,
38 }).pipe(Effect.option);
39 expect(deleted._tag).toBe("None");
40 }),
41 { tags: ["provider:aws", "provider:aws:iam", "live"] },
42 );