@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

main
ts 40 lines 1.57 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { expect } from "@alchemy.run/test";
3 import * as Test from "@alchemy.run/test/Alchemy";
4 import * as transcribe from "@distilled.cloud/aws/transcribe";
5 import * as Effect from "effect/Effect";
6 import * as Result from "effect/Result";
7
8 const { test } = Test.make({ providers: AWS.providers() });
9
10 // Ungated typed-error probe: reading a nonexistent transcription job must
11 // surface as a typed error from distilled's `GetTranscriptionJobError` union —
12 // proves the SDK's typed error mapping and that the binding's callable is wired
13 // against the real batch API, at zero cost (no S3 media, no job). The full
14 // start→poll lifecycle needs an S3 audio input and multi-minute async
15 // processing; it is skipped under `--fast`.
16 //
17 // NOTE: AWS Transcribe reports a missing job as `BadRequestException` ("The
18 // requested job couldn't be found."), NOT `NotFoundException` — a documented
19 // API quirk. Both tags are in the typed union; we assert the one AWS actually
20 // returns.
21 test.provider(
22 "reading a nonexistent transcription job returns a typed BadRequestException",
23 (_stack) =>
24 Effect.gen(function* () {
25 const result = yield* Effect.result(
26 transcribe.getTranscriptionJob({
27 TranscriptionJobName: "alchemy-nonexistent-job-probe",
28 }),
29 );
30
31 expect(Result.isFailure(result)).toBe(true);
32 if (Result.isFailure(result)) {
33 expect(result.failure._tag).toBe("BadRequestException");
34 }
35 }),
36 {
37 tags: ["provider:aws", "provider:aws:transcribe", "live"],
38 timeout: 60_000,
39 },
40 );