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

main
ts 58 lines 2 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { ActiveReceiptRuleSet, ReceiptRuleSet } from "@alchemy.run/aws/SES";
3 import { expect } from "@alchemy.run/test";
4 import * as Test from "@alchemy.run/test/Alchemy";
5 import * as ses from "@distilled.cloud/aws/ses";
6 import * as Effect from "effect/Effect";
7
8 const { test } = Test.make({ providers: AWS.providers() });
9
10 const activeRuleSetName = ses
11 .describeActiveReceiptRuleSet({})
12 .pipe(Effect.map((response) => response.Metadata?.Name));
13
14 // Account-singleton pointer: capture whatever the account currently points at,
15 // run the lifecycle, then restore it. The "aws:ses-account" label keeps the
16 // other SES account-singleton tests from observing the mutated active pointer.
17 test.provider(
18 "active receipt rule set: point the account at a rule set, then deactivate",
19 (stack) =>
20 Effect.gen(function* () {
21 const captured = yield* activeRuleSetName;
22
23 yield* Effect.gen(function* () {
24 yield* stack.destroy();
25
26 const { ruleSet } = yield* stack.deploy(
27 Effect.gen(function* () {
28 const ruleSet = yield* ReceiptRuleSet("ActiveSet", {});
29 yield* ActiveReceiptRuleSet("Active", {
30 ruleSetName: ruleSet.ruleSetName,
31 });
32 return { ruleSet };
33 }),
34 );
35
36 // out-of-band verification via distilled: the account now points here
37 const active = yield* activeRuleSetName;
38 expect(active).toBe(ruleSet.ruleSetName);
39
40 yield* stack.destroy();
41
42 // deleting our pointer deactivated receiving (we still owned it)
43 const afterDestroy = yield* activeRuleSetName;
44 expect(afterDestroy).not.toBe(ruleSet.ruleSetName);
45 }).pipe(
46 Effect.ensuring(
47 captured
48 ? ses.setActiveReceiptRuleSet({ RuleSetName: captured }).pipe(Effect.ignore)
49 : Effect.void,
50 ),
51 );
52 }),
53 {
54 tags: ["provider:aws", "provider:aws:ses", "live"],
55 timeout: 120_000,
56 exclusive: "aws:ses-account",
57 },
58 );