The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as AWS from "@alchemy.run/aws"; |
| 2 | import { InternetGateway } from "@alchemy.run/aws/EC2"; |
| 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 | import { MinimumLogLevel } from "effect/References"; |
| 8 | import { assertInternetGatewayGone } from "./Gone.ts"; |
| 9 | |
| 10 | const { test } = Test.make({ providers: AWS.providers() }); |
| 11 | |
| 12 | const logLevel = Effect.provideService(MinimumLogLevel, process.env.DEBUG ? "Debug" : "Info"); |
| 13 | |
| 14 | test.provider( |
| 15 | "list enumerates the deployed InternetGateway", |
| 16 | (stack) => |
| 17 | Effect.gen(function* () { |
| 18 | yield* stack.destroy(); |
| 19 | |
| 20 | const deployed = yield* stack.deploy( |
| 21 | Effect.gen(function* () { |
| 22 | return yield* InternetGateway("ListInternetGateway", {}); |
| 23 | }), |
| 24 | ); |
| 25 | |
| 26 | const provider = yield* Provider.findProvider(InternetGateway); |
| 27 | const all = yield* provider.list(); |
| 28 | |
| 29 | expect(all.some((x) => x.internetGatewayId === deployed.internetGatewayId)).toBe(true); |
| 30 | |
| 31 | yield* stack.destroy(); |
| 32 | |
| 33 | yield* assertInternetGatewayGone(deployed.internetGatewayId); |
| 34 | }).pipe(logLevel), |
| 35 | { tags: ["provider:aws", "provider:aws:ec2", "live"] }, |
| 36 | ); |