The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as NodePath from "@effect/platform-node/NodePath"; |
| 2 | import * as NodeServices from "@effect/platform-node/NodeServices"; |
| 3 | import { assert, describe, it } from "@effect/vitest"; |
| 4 | import { CLI_RELEASE_BASE_URL_ENV } from "@t3tools/shared/cliRelease"; |
| 5 | import * as Effect from "effect/Effect"; |
| 6 | import * as Layer from "effect/Layer"; |
| 7 | |
| 8 | import * as DesktopConfig from "../app/DesktopConfig.ts"; |
| 9 | import * as DesktopEnvironment from "../app/DesktopEnvironment.ts"; |
| 10 | import { resolveDesktopSshCliRunner } from "./DesktopSshEnvironment.ts"; |
| 11 | |
| 12 | const packagedEnvironment = DesktopEnvironment.DesktopEnvironment.pipe( |
| 13 | Effect.provide( |
| 14 | DesktopEnvironment.layer({ |
| 15 | dirname: "/Applications/T3 Code.app/Contents/Resources/app.asar/dist-electron", |
| 16 | homeDirectory: "/Users/alice", |
| 17 | platform: "darwin", |
| 18 | processArch: "arm64", |
| 19 | appVersion: "0.0.22", |
| 20 | appPath: "/Applications/T3 Code.app/Contents/Resources/app.asar", |
| 21 | isPackaged: true, |
| 22 | resourcesPath: "/Applications/T3 Code.app/Contents/Resources", |
| 23 | runningUnderArm64Translation: false, |
| 24 | }).pipe( |
| 25 | Layer.provide( |
| 26 | Layer.mergeAll(NodeServices.layer, NodePath.layerPosix, DesktopConfig.layerTest({})), |
| 27 | ), |
| 28 | ), |
| 29 | ), |
| 30 | ); |
| 31 | |
| 32 | describe("resolveDesktopSshCliRunner", () => { |
| 33 | it.effect("downloads the remote runner from the release mirror", () => |
| 34 | Effect.gen(function* () { |
| 35 | const environment = yield* packagedEnvironment; |
| 36 | |
| 37 | const runner = resolveDesktopSshCliRunner(environment, { |
| 38 | [CLI_RELEASE_BASE_URL_ENV]: "https://mirror.example.com/t3code", |
| 39 | }); |
| 40 | |
| 41 | assert.deepStrictEqual(runner, { |
| 42 | archiveVersion: "0.0.22", |
| 43 | releaseBaseUrl: "https://mirror.example.com/t3code", |
| 44 | }); |
| 45 | }), |
| 46 | ); |
| 47 | }); |