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

main
ts 32 lines 1.33 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { AccountAlias } from "@alchemy.run/aws/IAM/AccountAlias";
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 (account singleton): an AWS account has at most one
11 // alias, so `list()` returns a one-element array (the single alias) or `[]`.
12 //
13 // Setting/deleting the account alias is account-wide and disruptive — it would
14 // clobber whatever alias the account already has — so this is an UNGATED probe
15 // that only observes: it calls `list()` and asserts a well-formed result
16 // (length 0 or 1, with the full `{ accountAlias }` Attributes shape when set).
17 test.provider(
18 "list enumerates the account alias singleton",
19 () =>
20 Effect.gen(function* () {
21 const provider = yield* Provider.findProvider(AccountAlias);
22 const all = yield* provider.list();
23
24 expect(Array.isArray(all)).toBe(true);
25 expect(all.length).toBeLessThanOrEqual(1);
26 for (const item of all) {
27 expect(typeof item.accountAlias).toBe("string");
28 expect(item.accountAlias.length).toBeGreaterThan(0);
29 }
30 }),
31 { tags: ["provider:aws", "provider:aws:iam", "live"] },
32 );