t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/AWS/IdentityCenter/Instance.test.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

34 lines
1.4 KiB
TypeScript

import * as AWS from "@/AWS";
import { Instance } from "@/AWS/IdentityCenter";
import * as Provider from "@/Provider";
import * as Test from "@/Test/Alchemy";
import { expect } from "alchemy-test";
import * as Effect from "effect/Effect";
const { test } = Test.make({ providers: AWS.providers() });
// An IAM Identity Center instance is a pre-existing account/organization
// singleton — you generally cannot create one inside a test. `list()`
// enumerates every visible instance via `ListInstances` and returns the
// exact `read` Attributes shape. Accounts without SSO enabled return `[]`
// (not an error), so this test asserts a well-typed `Attributes[]` and
// validates the element shape only when at least one instance exists.
test.provider(
"list enumerates visible Identity Center instances",
() =>
Effect.gen(function* () {
const provider = yield* Provider.findProvider(Instance);
const all = yield* provider.list();
expect(Array.isArray(all)).toBe(true);
for (const instance of all) {
expect(typeof instance.instanceArn).toBe("string");
expect(instance.instanceArn.length).toBeGreaterThan(0);
expect(typeof instance.identityStoreId).toBe("string");
expect(instance.identityStoreId.length).toBeGreaterThan(0);
expect(instance.mode).toBe("existing");
}
}),
{ tags: ["provider:aws", "provider:aws:identitycenter", "live"] },
);