48 lines
1.6 KiB
TypeScript
48 lines
1.6 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { resolveCliInstallSourcePath } from "./cli-install-path";
|
|
|
|
describe("cli-install-path", () => {
|
|
it("uses the packaged executable on supported unix platforms", () => {
|
|
expect(
|
|
resolveCliInstallSourcePath({
|
|
platform: "darwin",
|
|
isPackaged: true,
|
|
executablePath: "/Applications/Paseo.app/Contents/MacOS/Paseo",
|
|
shimPath: "/Applications/Paseo.app/Contents/Resources/bin/paseo",
|
|
}),
|
|
).toBe("/Applications/Paseo.app/Contents/MacOS/Paseo");
|
|
});
|
|
|
|
it("prefers the original AppImage path on linux", () => {
|
|
expect(
|
|
resolveCliInstallSourcePath({
|
|
platform: "linux",
|
|
isPackaged: true,
|
|
executablePath: "/tmp/.mount_paseo123/paseo",
|
|
shimPath: "/tmp/.mount_paseo123/resources/bin/paseo",
|
|
appImagePath: "/home/user/Applications/Paseo.AppImage",
|
|
}),
|
|
).toBe("/home/user/Applications/Paseo.AppImage");
|
|
});
|
|
|
|
it("falls back to the shim on windows and in development", () => {
|
|
expect(
|
|
resolveCliInstallSourcePath({
|
|
platform: "win32",
|
|
isPackaged: true,
|
|
executablePath: "C:\\Users\\user\\AppData\\Local\\Programs\\Paseo\\Paseo.exe",
|
|
shimPath: "C:\\Users\\user\\AppData\\Local\\Programs\\Paseo\\resources\\bin\\paseo.cmd",
|
|
}),
|
|
).toBe("C:\\Users\\user\\AppData\\Local\\Programs\\Paseo\\resources\\bin\\paseo.cmd");
|
|
|
|
expect(
|
|
resolveCliInstallSourcePath({
|
|
platform: "linux",
|
|
isPackaged: false,
|
|
executablePath: "/opt/Paseo/paseo",
|
|
shimPath: "/opt/Paseo/resources/bin/paseo",
|
|
}),
|
|
).toBe("/opt/Paseo/resources/bin/paseo");
|
|
});
|
|
});
|