@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, 03:37 UTC

main
ts 51 lines 1.76 KB
Raw
1 import * as Schema from "effect/Schema";
2 import { describe, expect, it } from "vite-plus/test";
3
4 import { ExecutionEnvironmentDescriptor } from "./environment.ts";
5
6 const decodeDescriptor = Schema.decodeUnknownSync(ExecutionEnvironmentDescriptor);
7
8 const descriptor = {
9 environmentId: "environment-1",
10 label: "Local",
11 platform: { os: "darwin", arch: "arm64" },
12 serverVersion: "0.0.32",
13 capabilities: { repositoryIdentity: true },
14 } as const;
15
16 describe("ExecutionEnvironmentDescriptor", () => {
17 it("decodes old, recognized and future manual installation descriptors", () => {
18 expect(decodeDescriptor(descriptor).capabilities.serverInstallation).toBeUndefined();
19 for (const installation of [
20 { kind: "npx" },
21 { kind: "npm-global", prefix: "/opt/node" },
22 { kind: "t3-launcher", launcher: "/opt/bin/t3", baseDir: "/data/t3" },
23 ]) {
24 expect(
25 decodeDescriptor({
26 ...descriptor,
27 capabilities: { ...descriptor.capabilities, serverInstallation: installation },
28 }).capabilities.serverInstallation,
29 ).toEqual(installation);
30 }
31 const spaced = { kind: "t3-launcher", launcher: "/opt/bin/t3 ", baseDir: " /data/t3 " };
32 expect(
33 decodeDescriptor({
34 ...descriptor,
35 capabilities: { ...descriptor.capabilities, serverInstallation: spaced },
36 }).capabilities.serverInstallation,
37 ).toEqual(spaced);
38 for (const installation of [
39 { kind: "future-manager" },
40 { kind: "npm-global" },
41 { kind: "t3-launcher", launcher: "t3" },
42 ]) {
43 expect(
44 decodeDescriptor({
45 ...descriptor,
46 capabilities: { ...descriptor.capabilities, serverInstallation: installation },
47 }).capabilities.serverInstallation,
48 ).toBeUndefined();
49 }
50 });
51 });