дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 17:47:08 +02:00
In an SSH or WSL window, Export Test Results passed a path picked in the desktop's Save dialog to the project host. Project-side pickers (Export Test Results, Save As, patch and Git dialogs, Maven/Gradle linking, scopes, coverage and Java sources, database source files, deployment destinations, tool and plugin paths) now browse the project host, with overwrite confirmation kept; flows whose files belong to the desktop (keymap and color scheme import/export, database and ACP imports, Clone) read and write through the desktop process. Follow-up to #5439.
41 рядки
1.5 KiB
TypeScript
41 рядки
1.5 KiB
TypeScript
import { afterEach, beforeEach, expect, it, vi } from "vitest";
|
|
import { readDesktopText, writeDesktopText } from "./desktopFiles";
|
|
import { useRemote } from "./remote";
|
|
import { setInvokeRoute } from "./tauriCore";
|
|
|
|
const invoke = vi.fn();
|
|
const remoteInvoke = vi.fn();
|
|
|
|
beforeEach(() => {
|
|
vi.clearAllMocks();
|
|
vi.stubGlobal("__TAURI_INTERNALS__", { invoke });
|
|
useRemote.setState({ session: { root: "/srv/project", os: "linux" } as never });
|
|
setInvokeRoute(remoteInvoke);
|
|
});
|
|
|
|
afterEach(() => {
|
|
setInvokeRoute(null);
|
|
useRemote.setState({ session: null });
|
|
vi.unstubAllGlobals();
|
|
});
|
|
|
|
it("reads desktop settings or import files even when project IPC is remote", async () => {
|
|
const path = "C:\\Users\\me\\settings.xml";
|
|
invoke.mockResolvedValueOnce("<settings />");
|
|
await expect(readDesktopText(path)).resolves.toBe("<settings />");
|
|
expect(invoke.mock.calls[0]?.slice(0, 2)).toEqual(["fs_read_text", { path }]);
|
|
expect(remoteInvoke).not.toHaveBeenCalled();
|
|
});
|
|
|
|
it("checks and replaces an existing desktop file on the desktop", async () => {
|
|
const path = "C:\\Users\\me\\scheme.icls";
|
|
invoke.mockResolvedValueOnce("file").mockResolvedValueOnce(null).mockResolvedValueOnce(null);
|
|
await writeDesktopText(path, "é");
|
|
expect(invoke.mock.calls.map((args) => args.slice(0, 2))).toEqual([
|
|
["fs_entry_kind", { path }],
|
|
["fs_delete", { path }],
|
|
["fs_create_file_bytes", { path, data: "w6k=" }],
|
|
]);
|
|
expect(remoteInvoke).not.toHaveBeenCalled();
|
|
});
|