@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 80 lines 2.47 KB
Raw
1 import * as GCP from "@alchemy.run/gcp";
2 import { expect } from "@alchemy.run/test";
3 import * as Test from "@alchemy.run/test/Alchemy";
4 import * as datalabeling from "@distilled.cloud/gcp/datalabeling_v1beta1";
5 import * as Effect from "effect/Effect";
6 import { logLevel, probe, currentProject, runLifecycle, waitUntilGone } from "./common.ts";
7
8 const { test } = Test.make({ providers: GCP.providers() });
9
10 test.provider(
11 "getProjectsDatasets on a missing dataset fails with a typed tag",
12 (stack) =>
13 Effect.gen(function* () {
14 const project = yield* currentProject;
15 yield* stack.destroy();
16
17 const error = yield* Effect.flip(
18 probe(
19 datalabeling.getProjectsDatasets({
20 name: `projects/${project}/datasets/alchemy-missing-dataset`,
21 }),
22 ),
23 );
24 expect(error._tag).toEqual("NotFound");
25
26 yield* stack.destroy();
27 }).pipe(logLevel),
28 {
29 tags: ["provider:gcp", "provider:gcp:datalabeling", "live"],
30 timeout: 90_000,
31 },
32 );
33
34 test.provider.skipIf(!runLifecycle)(
35 "create, replace, and delete a dataset",
36 (stack) =>
37 Effect.gen(function* () {
38 yield* stack.destroy();
39
40 const created = yield* stack.deploy(
41 Effect.gen(function* () {
42 return yield* GCP.DataLabeling.Dataset("Images", {
43 displayName: "product-photos",
44 description: "sku images",
45 });
46 }),
47 );
48
49 expect(created.name).toContain("/datasets/");
50 expect(created.displayName).toEqual("product-photos");
51 expect(created.description).toEqual("sku images");
52
53 const fetched = yield* datalabeling.getProjectsDatasets({
54 name: created.name,
55 });
56 expect(fetched.name).toEqual(created.name);
57 expect(fetched.description).toContain("alchemy-id=");
58 expect(fetched.description).toContain("sku images");
59
60 const updated = yield* stack.deploy(
61 Effect.gen(function* () {
62 return yield* GCP.DataLabeling.Dataset("Images", {
63 datasetId: created.datasetId,
64 displayName: "product-photos",
65 description: "updated sku images",
66 });
67 }),
68 );
69
70 expect(updated.description).toEqual("updated sku images");
71
72 yield* stack.destroy();
73 const gone = yield* waitUntilGone(datalabeling.getProjectsDatasets({ name: updated.name }));
74 expect(gone).toEqual("gone");
75 }).pipe(logLevel),
76 {
77 tags: ["provider:gcp", "provider:gcp:datalabeling", "live"],
78 timeout: 90_000,
79 },
80 );