дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 03:05:40 +02:00
Opening another project in the same window left the previous project's state in module-level stores: Amend and the commit message carried over, debug sessions kept running, and Git Log, usages, hierarchy, inspection, HTTP client, recent locations, navigation history and notifications still showed the old project. Reset each of them on a project root change, stop the old debug sessions, ask about unsaved changes before leaving a project, close the settings window (it would apply to the new project) and end the indexing task when a scan is cancelled.
27 рядки
1.2 KiB
TypeScript
27 рядки
1.2 KiB
TypeScript
import { afterEach, describe, expect, it } from "vitest";
|
|
import { installPreparedMessage, useCommit } from "../commitStore";
|
|
import { installGitLog, useGitLog } from "../logStore";
|
|
import { logConsole, useVcsConsole } from "../ops";
|
|
import { useVcs } from "../store";
|
|
|
|
describe("switching the window to another repository", () => {
|
|
const disposers: Array<() => void> = [];
|
|
afterEach(() => disposers.splice(0).forEach((d) => d()));
|
|
|
|
it("drops the commit message, Amend and the log of the previous one", () => {
|
|
useVcs.setState({ root: "/a" });
|
|
disposers.push(installPreparedMessage(), installGitLog());
|
|
useCommit.setState({ message: "wip", amend: true, selection: ["/a/x"] });
|
|
useGitLog.setState({ commits: [{ id: "c1" } as never], selected: "c1", selection: ["c1"] });
|
|
useGitLog.setState((s) => ({ filters: { ...s.filters, author: "me" } }));
|
|
logConsole("cmd", "git status");
|
|
|
|
useVcs.setState({ root: "/b" });
|
|
|
|
expect(useCommit.getState()).toMatchObject({ message: "", amend: false, selection: [] });
|
|
expect(useGitLog.getState()).toMatchObject({ commits: [], selected: null, selection: [] });
|
|
expect(useGitLog.getState().filters.author).toBe("");
|
|
expect(useVcsConsole.getState().lines).toEqual([]);
|
|
});
|
|
});
|