1import { describe, expect, it } from "vite-plus/test";
2
3import { editorLabelForPlatform, openInEditorMenuLabel } from "./editorLabels";
4
5describe("editorLabelForPlatform", () => {
6 it("uses the editor name from the shared editor definitions", () => {
7 expect(editorLabelForPlatform("cursor", "MacIntel")).toBe("Cursor");
8 expect(editorLabelForPlatform("vscode-insiders", "Win32")).toBe("VS Code Insiders");
9 });
10
11 it.each([
12 ["MacIntel", "Finder"],
13 ["Win32", "File Explorer"],
14 ["Linux x86_64", "Files"],
15 ])("uses the platform file-manager name on %s", (platform, label) => {
16 expect(editorLabelForPlatform("file-manager", platform)).toBe(label);
17 });
18});
19
20describe("openInEditorMenuLabel", () => {
21 it("names the preferred editor", () => {
22 expect(openInEditorMenuLabel("zed")).toBe("Open in Zed");
23 });
24
25 it("keeps the generic label for the default file handler and missing preferences", () => {
26 expect(openInEditorMenuLabel("file-manager")).toBe("Open in editor");
27 expect(openInEditorMenuLabel(null)).toBe("Open in editor");
28 });
29});