t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/AWS/IAM/AccountAlias.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

32 lines
1.3 KiB
TypeScript

import * as AWS from "@/AWS";
import { AccountAlias } from "@/AWS/IAM/AccountAlias.ts";
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() });
// Canonical `list()` test (account singleton): an AWS account has at most one
// alias, so `list()` returns a one-element array (the single alias) or `[]`.
//
// Setting/deleting the account alias is account-wide and disruptive — it would
// clobber whatever alias the account already has — so this is an UNGATED probe
// that only observes: it calls `list()` and asserts a well-formed result
// (length 0 or 1, with the full `{ accountAlias }` Attributes shape when set).
test.provider(
"list enumerates the account alias singleton",
() =>
Effect.gen(function* () {
const provider = yield* Provider.findProvider(AccountAlias);
const all = yield* provider.list();
expect(Array.isArray(all)).toBe(true);
expect(all.length).toBeLessThanOrEqual(1);
for (const item of all) {
expect(typeof item.accountAlias).toBe("string");
expect(item.accountAlias.length).toBeGreaterThan(0);
}
}),
{ tags: ["provider:aws", "provider:aws:iam", "live"] },
);