@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 51 lines 2.01 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { Group } from "@alchemy.run/aws/IdentityCenter";
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 // Identity Center requires an enabled SSO instance / identity store in the
11 // testing account. If unavailable, `resolveIdentityStoreId` fails with:
12 // Error: "Unable to resolve a single visible Identity Center instance; pass instanceArn explicitly"
13 // The testing account is an organization management account where
14 // `CreateInstance` fails with a typed ValidationException ("Organization
15 // management account is not allowed to perform the operation."), so an
16 // instance cannot be provisioned programmatically. Gate the live list test
17 // behind ALCHEMY_TEST_IDENTITY_CENTER=1 so an entitled account runs it
18 // unchanged.
19 const SKIP_IDENTITY_CENTER = !process.env.ALCHEMY_TEST_IDENTITY_CENTER;
20
21 // Canonical `list()` test (AWS account-scoped collection within the identity
22 // store): deploy a real group, resolve the provider from context via the typed
23 // `findProvider`, call `list()`, and assert the deployed group appears in the
24 // exhaustively-paginated result.
25 test.provider.skipIf(SKIP_IDENTITY_CENTER)(
26 "list enumerates the deployed group",
27 (stack) =>
28 Effect.gen(function* () {
29 yield* stack.destroy();
30
31 const group = yield* stack.deploy(
32 Effect.gen(function* () {
33 return yield* Group("ListGroup", {
34 displayName: "alchemy-list-test-group",
35 description: "Group used to verify list() enumeration",
36 });
37 }),
38 );
39
40 const provider = yield* Provider.findProvider(Group);
41 const all = yield* provider.list();
42
43 expect(all.some((g) => g.groupId === group.groupId)).toBe(true);
44
45 yield* stack.destroy();
46 }),
47 {
48 tags: ["provider:aws", "provider:aws:identitycenter", "live"],
49 timeout: 180_000,
50 },
51 );