The best way to control Claude Code, Codex and more from any computer or phone

main
ts 40 lines 1.63 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { AlarmMuteRule } from "@alchemy.run/aws/CloudWatch";
3 import { expect } from "@alchemy.run/test";
4 import * as Test from "@alchemy.run/test/Alchemy";
5 import * as Provider from "alchemy/Provider";
6 import * as Effect from "effect/Effect";
7
8 const { test } = Test.make({ providers: AWS.providers() });
9
10 // Canonical `list()` test (AWS account/region-scoped collection).
11 //
12 // `AlarmMuteRule` is enumerable: `listAlarmMuteRules` paginates every mute
13 // rule in the region (verified live). `list()` flattens those summaries,
14 // derives the name from each ARN, and re-reads each rule via
15 // `getAlarmMuteRule` to return the full `Attributes` shape (identical to
16 // `read`).
17 //
18 // NOTE: We do not deploy a rule first because `putAlarmMuteRule` currently
19 // rejects every input with an (empty-message) `ValidationException` — a
20 // separate create-path blocker independent of `list()`. We therefore verify
21 // `list()` runs against the live API and returns the well-typed `Attributes`
22 // array. When create is unblocked, the deploy-and-find-it assertion below can
23 // be re-enabled.
24 test.provider(
25 "list enumerates alarm mute rules in the region",
26 (stack) =>
27 Effect.gen(function* () {
28 yield* stack.destroy();
29
30 const provider = yield* Provider.findProvider(AlarmMuteRule);
31 const all = yield* provider.list();
32
33 expect(Array.isArray(all)).toBe(true);
34 for (const rule of all) {
35 expect(typeof rule.alarmMuteRuleName).toBe("string");
36 expect(rule.alarmMuteRuleArn).toContain(":alarm-mute-rule:");
37 }
38 }),
39 { tags: ["provider:aws", "provider:aws:cloudwatch", "live"] },
40 );