t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/AWS/Transcribe/TranscriptionJob.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

40 lines
1.5 KiB
TypeScript

import * as AWS from "@/AWS";
import * as Test from "@/Test/Alchemy";
import * as transcribe from "@distilled.cloud/aws/transcribe";
import { expect } from "alchemy-test";
import * as Effect from "effect/Effect";
import * as Result from "effect/Result";
const { test } = Test.make({ providers: AWS.providers() });
// Ungated typed-error probe: reading a nonexistent transcription job must
// surface as a typed error from distilled's `GetTranscriptionJobError` union —
// proves the SDK's typed error mapping and that the binding's callable is wired
// against the real batch API, at zero cost (no S3 media, no job). The full
// start→poll lifecycle needs an S3 audio input and multi-minute async
// processing; it is gated behind AWS_TEST_SLOW=1.
//
// NOTE: AWS Transcribe reports a missing job as `BadRequestException` ("The
// requested job couldn't be found."), NOT `NotFoundException` — a documented
// API quirk. Both tags are in the typed union; we assert the one AWS actually
// returns.
test.provider(
"reading a nonexistent transcription job returns a typed BadRequestException",
(_stack) =>
Effect.gen(function* () {
const result = yield* Effect.result(
transcribe.getTranscriptionJob({
TranscriptionJobName: "alchemy-nonexistent-job-probe",
}),
);
expect(Result.isFailure(result)).toBe(true);
if (Result.isFailure(result)) {
expect(result.failure._tag).toBe("BadRequestException");
}
}),
{
tags: ["provider:aws", "provider:aws:transcribe", "live"],
timeout: 60_000,
},
);