t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/AWS/Organizations/OrganizationResourcePolicy.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 { OrganizationResourcePolicy } from "@/AWS/Organizations";
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() });
// The org resource policy is a singleton with no list API. `list()` describes
// the single resource policy and returns a one-element array if present, else
// []. This runs read-only: a missing policy or a non-org account both yield []
// via the typed ResourcePolicyNotFoundException / AWSOrganizationsNotInUseException
// catches, so the assertion holds without deploying anything.
test.provider(
"list enumerates the organization resource policy",
() =>
Effect.gen(function* () {
const provider = yield* Provider.findProvider(OrganizationResourcePolicy);
const all = yield* provider.list();
expect(Array.isArray(all)).toBe(true);
expect(all.length).toBeLessThanOrEqual(1);
for (const policy of all) {
expect(typeof policy.resourcePolicyId).toBe("string");
expect(typeof policy.resourcePolicyArn).toBe("string");
expect(policy.document).toBeDefined();
}
}),
{ tags: ["provider:aws", "provider:aws:organizations", "live"] },
);