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

50 lines
1.7 KiB
TypeScript

import * as AWS from "@/AWS";
import * as Provider from "@/Provider";
import * as Test from "./Test.ts";
import * as ag from "@distilled.cloud/aws/api-gateway";
import { expect } from "alchemy-test";
import * as Effect from "effect/Effect";
import { assertRestApiDeleted } from "./assertions.ts";
const { test } = Test.make({ providers: AWS.providers() });
// Both resource cases require the same parent and child shape. Keep their
// out-of-band read and provider-list assertions in one lifecycle so the
// regional DeleteRestApi throttle is crossed once rather than twice.
test.provider.skipIf(!!process.env.FAST)(
"API Gateway resource lifecycle and list",
(stack) =>
Effect.gen(function* () {
yield* stack.destroy();
const { api, res } = yield* stack.deploy(
Effect.gen(function* () {
const api = yield* AWS.ApiGateway.RestApi("AgResApi", {
endpointConfiguration: { types: ["REGIONAL"] },
});
const res = yield* AWS.ApiGateway.Resource("AgSubPath", {
restApi: api,
parentId: api.rootResourceId,
pathPart: "items",
});
return { api, res };
}),
);
const remote = yield* ag.getResource({
restApiId: api.restApiId,
resourceId: res.resourceId,
});
expect(remote.pathPart).toEqual("items");
const provider = yield* Provider.findProvider(
AWS.ApiGateway.GatewayResource,
);
const all = yield* provider.list();
expect(all.some((r) => r.resourceId === res.resourceId)).toBe(true);
yield* stack.destroy();
yield* assertRestApiDeleted(api.restApiId);
}),
{ tags: ["provider:aws", "provider:aws:apigateway", "live"] },
);