t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/AWS/IAM/VirtualMFADevice.test.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

48 lines
1.5 KiB
TypeScript

import * as AWS from "@/AWS";
import { VirtualMFADevice } from "@/AWS/IAM";
import * as Provider from "@/Provider";
import * as Test from "@/Test/Alchemy";
import { describe, expect } from "alchemy-test";
import * as Effect from "effect/Effect";
const { test } = Test.make({ providers: AWS.providers() });
describe(
"AWS.IAM.VirtualMFADevice",
{ tags: ["provider:aws", "provider:aws:iam", "live"] },
() => {
test.provider("list enumerates the deployed virtual MFA device", (stack) =>
Effect.gen(function* () {
yield* stack.destroy();
const device = yield* stack.deploy(
Effect.gen(function* () {
return yield* VirtualMFADevice("ListVirtualMfaDevice", {
tags: {
env: "test",
},
});
}),
);
const provider = yield* Provider.findProvider(VirtualMFADevice);
const all = yield* provider.list();
const found = all.find(
(entry) => entry.serialNumber === device.serialNumber,
);
expect(found).toBeDefined();
expect(found?.tags).toMatchObject({ env: "test" });
yield* stack.destroy();
// IAM has no get-virtual-mfa-device API; re-list exhaustively and
// assert the device's serial number no longer appears.
const remaining = yield* provider.list();
expect(
remaining.some((entry) => entry.serialNumber === device.serialNumber),
).toBe(false);
}),
);
},
);