1import * as AWS from "@/AWS";
2import { AlarmMuteRule } from "@/AWS/CloudWatch";
3import * as Provider from "@/Provider";
4import * as Test from "@/Test/Alchemy";
5import { expect } from "alchemy-test";
6import * as Effect from "effect/Effect";
7
8const { 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.
24test.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);