@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, 04:45 UTC

main
ts 59 lines 2.25 KB
Raw
1 import * as Axiom from "@alchemy.run/axiom";
2 import { expect } from "@alchemy.run/test";
3 import * as Test from "@alchemy.run/test/Alchemy";
4 import * as Provider from "alchemy/Provider";
5 import * as Effect from "effect/Effect";
6 import { MinimumLogLevel } from "effect/References";
7
8 const { test } = Test.make({ providers: Axiom.providers() });
9
10 const logLevel = Effect.provideService(MinimumLogLevel, process.env.DEBUG ? "Debug" : "Info");
11
12 // Axiom credentials are resolved via the AuthProvider (env method reads
13 // AXIOM_TOKEN / AXIOM_API_KEY). When neither is present the suite can't talk
14 // to the real API, so skipIf-gate the live list test. On an entitled run the
15 // failure mode without creds is an `AuthError`:
16 // "Axiom env credentials not found. Set AXIOM_TOKEN (or AXIOM_API_KEY)."
17 const hasAxiomCreds = !!(process.env.AXIOM_TOKEN || process.env.AXIOM_API_KEY);
18
19 // Deterministic dataset name so re-runs reuse (and reconcile) the same dataset
20 // rather than piling up duplicates.
21 const DATASET_NAME = "alchemy-test-annotation-list";
22
23 test.provider.skipIf(!hasAxiomCreds)(
24 "list enumerates the deployed annotation",
25 (stack) =>
26 Effect.gen(function* () {
27 yield* stack.destroy();
28
29 const deployed = yield* stack.deploy(
30 Effect.gen(function* () {
31 const dataset = yield* Axiom.Dataset("ListDataset", {
32 name: DATASET_NAME,
33 });
34 return yield* Axiom.Annotation("ListAnnotation", {
35 type: "deploy",
36 title: "list() coverage marker",
37 datasets: [dataset.name],
38 time: "2026-01-01T00:00:00Z",
39 });
40 }),
41 );
42
43 const provider = yield* Provider.findProvider(Axiom.Annotation);
44 const all = yield* provider.list();
45
46 // `getAnnotations` returns the full account-wide list in one shot; the
47 // freshly created annotation must be present, hydrated into the exact
48 // `read` shape (so `.id` / `.type` are directly usable by `delete`).
49 const found = all.find((a) => a.id === deployed.id);
50 expect(found).toBeDefined();
51 expect(found?.type).toEqual("deploy");
52
53 yield* stack.destroy();
54 }).pipe(logLevel),
55 {
56 tags: ["provider:axiom", "provider:axiom:annotation", "provider:axiom:dataset", "live"],
57 timeout: 120_000,
58 },
59 );