The best way to control Claude Code, Codex and more from any computer or phone

main
ts 43 lines 1.59 KB
Raw
1 import { describe, expect, it } from "vite-plus/test";
2
3 import { azureCliInstall } from "./azureCliLauncher.ts";
4
5 describe("azureCliInstall", () => {
6 const msiRoot = "C:\\Program Files\\Microsoft SDKs\\Azure\\CLI2";
7 const zipRoot = "D:\\azure-cli";
8 const cliPackage = (root: string) => `${root}\\Lib\\site-packages\\azure\\cli`;
9
10 const paths =
11 (...entries: Array<string>) =>
12 (filePath: string) =>
13 entries.includes(filePath);
14
15 it("runs the MSI launcher's interpreter", () => {
16 expect(
17 azureCliInstall(
18 `${msiRoot}\\wbin\\az.cmd`,
19 paths(`${msiRoot}\\python.exe`, cliPackage(msiRoot)),
20 ),
21 ).toEqual({ interpreter: `${msiRoot}\\python.exe`, installer: "MSI" });
22 });
23
24 it("runs the ZIP launcher's interpreter", () => {
25 expect(
26 azureCliInstall(
27 `${zipRoot}\\bin\\az.cmd`,
28 paths(`${zipRoot}\\python.exe`, cliPackage(zipRoot)),
29 ),
30 ).toEqual({ interpreter: `${zipRoot}\\python.exe`, installer: "ZIP" });
31 });
32
33 it("leaves anything that is not the Azure CLI alone", () => {
34 expect(azureCliInstall(`${zipRoot}\\bin\\az.exe`, () => true)).toBeUndefined();
35 expect(azureCliInstall(`${zipRoot}\\azure-cli\\az.cmd`, () => true)).toBeUndefined();
36 // Another tool's `bin\az.cmd` beside a `python.exe`, without the CLI's own packages.
37 expect(
38 azureCliInstall(`${zipRoot}\\bin\\az.cmd`, paths(`${zipRoot}\\python.exe`)),
39 ).toBeUndefined();
40 // The CLI's packages without the interpreter its launcher runs.
41 expect(azureCliInstall(`${msiRoot}\\wbin\\az.cmd`, paths(cliPackage(msiRoot)))).toBeUndefined();
42 });
43 });