* Add WebStorm editor target * Fix rebase type errors and add TODO date tag - Await listAvailableEditorTargets() which became async on main - Wrap sendAgentMessage callback to match Promise<void> return type - Add TODO(2026-07) date to legacy editor target ids comment --------- Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
27 lines
1008 B
TypeScript
27 lines
1008 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { resolvePreferredEditorId } from "./use-preferred-editor";
|
|
|
|
describe("resolvePreferredEditorId", () => {
|
|
it("keeps the stored editor when it is still available", () => {
|
|
expect(resolvePreferredEditorId(["cursor", "vscode"], "vscode")).toBe("vscode");
|
|
});
|
|
|
|
it("falls back to the first available editor when the stored one is missing", () => {
|
|
expect(resolvePreferredEditorId(["zed", "finder"], "cursor")).toBe("zed");
|
|
});
|
|
|
|
it("falls back when a platform-specific file manager target is unavailable", () => {
|
|
expect(resolvePreferredEditorId(["explorer", "vscode"], "finder")).toBe("explorer");
|
|
});
|
|
|
|
it("keeps unknown editor ids when they are still available", () => {
|
|
expect(resolvePreferredEditorId(["unknown-editor", "cursor"], "unknown-editor")).toBe(
|
|
"unknown-editor",
|
|
);
|
|
});
|
|
|
|
it("returns null when no editors are available", () => {
|
|
expect(resolvePreferredEditorId([], "cursor")).toBeNull();
|
|
});
|
|
});
|