@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 48 lines 1.71 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { expect } from "@alchemy.run/test";
3 import * as ag from "@distilled.cloud/aws/api-gateway";
4 import * as Provider from "alchemy/Provider";
5 import * as Effect from "effect/Effect";
6 import { assertRestApiDeleted } from "./assertions.ts";
7 import * as Test from "./Test.ts";
8
9 const { test } = Test.make({ providers: AWS.providers() });
10
11 // Both resource cases require the same parent and child shape. Keep their
12 // out-of-band read and provider-list assertions in one lifecycle so the
13 // regional DeleteRestApi throttle is crossed once rather than twice.
14 test.provider.skipIf(!!process.env.FAST)(
15 "API Gateway resource lifecycle and list",
16 (stack) =>
17 Effect.gen(function* () {
18 yield* stack.destroy();
19
20 const { api, res } = yield* stack.deploy(
21 Effect.gen(function* () {
22 const api = yield* AWS.ApiGateway.RestApi("AgResApi", {
23 endpointConfiguration: { types: ["REGIONAL"] },
24 });
25 const res = yield* AWS.ApiGateway.Resource("AgSubPath", {
26 restApi: api,
27 parentId: api.rootResourceId,
28 pathPart: "items",
29 });
30 return { api, res };
31 }),
32 );
33
34 const remote = yield* ag.getResource({
35 restApiId: api.restApiId,
36 resourceId: res.resourceId,
37 });
38 expect(remote.pathPart).toEqual("items");
39
40 const provider = yield* Provider.findProvider(AWS.ApiGateway.GatewayResource);
41 const all = yield* provider.list();
42 expect(all.some((r) => r.resourceId === res.resourceId)).toBe(true);
43
44 yield* stack.destroy();
45 yield* assertRestApiDeleted(api.restApiId);
46 }),
47 { tags: ["provider:aws", "provider:aws:apigateway", "live"] },
48 );