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
| 1 | import * as AWS from "@alchemy.run/aws"; |
| 2 | import { VirtualMFADevice } from "@alchemy.run/aws/IAM"; |
| 3 | import { describe, 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 | describe("AWS.IAM.VirtualMFADevice", { tags: ["provider:aws", "provider:aws:iam", "live"] }, () => { |
| 11 | test.provider("list enumerates the deployed virtual MFA device", (stack) => |
| 12 | Effect.gen(function* () { |
| 13 | yield* stack.destroy(); |
| 14 | |
| 15 | const device = yield* stack.deploy( |
| 16 | Effect.gen(function* () { |
| 17 | return yield* VirtualMFADevice("ListVirtualMfaDevice", { tags: { env: "test" } }); |
| 18 | }), |
| 19 | ); |
| 20 | |
| 21 | const provider = yield* Provider.findProvider(VirtualMFADevice); |
| 22 | const all = yield* provider.list(); |
| 23 | |
| 24 | const found = all.find((entry) => entry.serialNumber === device.serialNumber); |
| 25 | expect(found).toBeDefined(); |
| 26 | expect(found?.tags).toMatchObject({ env: "test" }); |
| 27 | |
| 28 | yield* stack.destroy(); |
| 29 | |
| 30 | // IAM has no get-virtual-mfa-device API; re-list exhaustively and |
| 31 | // assert the device's serial number no longer appears. |
| 32 | const remaining = yield* provider.list(); |
| 33 | expect(remaining.some((entry) => entry.serialNumber === device.serialNumber)).toBe(false); |
| 34 | }), |
| 35 | ); |
| 36 | }); |