@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 58 lines 1.77 KB
Raw
1 /**
2 * `AWS.DynamoDB.Table` under `alchemy dev`: the dualized provider deploys
3 * the table into the floci emulator, including Contributor Insights
4 * teardown (`DescribeContributorInsights` + CloudWatch `DescribeInsightRules`)
5 * on destroy.
6 *
7 * Requires Docker (floci runs as a container); skipped when unavailable.
8 */
9 import * as AWS from "@alchemy.run/aws";
10 import { expect } from "@alchemy.run/test";
11 import * as Test from "@alchemy.run/test/Alchemy";
12 import * as Effect from "effect/Effect";
13 import { rawAwsJson, regionOfArn } from "../Local/fixtures/raw.ts";
14
15 const { test } = Test.make({ providers: AWS.providers(), dev: true });
16
17 test.provider(
18 "dev table create/destroy against floci",
19 (stack) =>
20 Effect.gen(function* () {
21 yield* stack.destroy();
22
23 const table = yield* stack.deploy(
24 AWS.DynamoDB.Table("LocalTable", {
25 partitionKey: "id",
26 attributes: { id: "S" },
27 }),
28 );
29
30 expect(table.tableArn).toContain(":000000000000:");
31 expect(table.tableArn).toContain(":us-east-1:");
32
33 const region = regionOfArn(table.tableArn);
34 const described = yield* rawAwsJson({
35 service: "dynamodb",
36 region,
37 target: "DynamoDB_20120810.DescribeTable",
38 contentType: "application/x-amz-json-1.0",
39 body: { TableName: table.tableName },
40 });
41 expect(described.status).toBe(200);
42
43 yield* stack.destroy();
44
45 const after = yield* rawAwsJson({
46 service: "dynamodb",
47 region,
48 target: "DynamoDB_20120810.DescribeTable",
49 contentType: "application/x-amz-json-1.0",
50 body: { TableName: table.tableName },
51 });
52 expect(after.status).toBe(400);
53 }),
54 {
55 tags: ["provider:aws", "provider:aws:dynamodb", "local"],
56 timeout: 180_000,
57 },
58 );