27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
import { FolderClosedIcon } from "lucide-react";
|
|
import { describe, expect, it } from "vite-plus/test";
|
|
|
|
import { FileExplorerIcon, FinderIcon } from "../Icons";
|
|
import { resolveOpenInOptions } from "./OpenInPicker";
|
|
|
|
describe("resolveOpenInOptions", () => {
|
|
it.each([
|
|
["MacIntel", "Finder", FinderIcon],
|
|
["Win32", "File Explorer", FileExplorerIcon],
|
|
["Linux x86_64", "Files", FolderClosedIcon],
|
|
] as const)("includes the file manager with its icon on %s", (platform, label, Icon) => {
|
|
expect(resolveOpenInOptions(platform, ["cursor", "vscode", "file-manager"])).toEqual([
|
|
expect.objectContaining({ value: "cursor", label: "Cursor" }),
|
|
expect.objectContaining({ value: "vscode", label: "VS Code" }),
|
|
expect.objectContaining({ value: "file-manager", label, Icon }),
|
|
]);
|
|
});
|
|
|
|
it("omits the file manager when unavailable or using remote editors", () => {
|
|
expect(resolveOpenInOptions("MacIntel", ["vscode"])).toEqual([
|
|
expect.objectContaining({ value: "vscode" }),
|
|
]);
|
|
expect(resolveOpenInOptions("MacIntel", [])).toEqual([]);
|
|
});
|
|
});
|