Файли
openidea/src/platform/workflowSettings.test.ts
T
l0ng-ai eb67595e72 feat(vcs): Add a modal commit mode and fill in Git log, branch popup and settings (#144)
- Settings › Commit › "Use non-modal commit interface": when off, Local
  Changes, Shelf and Stash become tabs of the Git tool window and ⌘K opens
  a Commit dialog; switches live.
- Git tool window: Worktrees tab; Show History and Show Git Log for a
  branch open their own closable tabs instead of changing the Log filters.
- Log: toolbar and context menu for a commit's changed files, vertical
  toolbar, Tags node and hiding for the branches pane, Collapse / Expand
  Linear Branches as separate actions, and a Version Control › Log page.
- Branch popup: collapsible groups, branches grouped by prefix, an options
  menu behind the gear, incoming / outgoing icons and "Pull into … Using
  Rebase / Merge"; New Branch on ⌥⌘N outside the editor.
- Git main menu regrouped with Uncommitted Changes and Current File
  submenus; rebase / merge controls enabled only while one is in progress.
- Settings: Version Control lists its pages; new options for clearing the
  initial commit message, showing Update options, confirming dropped
  commits, revealing created patches, large-file and file-name warnings,
  the Push dialog after Commit and Push, combined stashes and shelves, and
  removing applied files from the shelf.
2026-10-28 21:49:43 +08:00

44 рядки
1.9 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { splitCommandLine } from "./commandLine";
import { DEFAULT_WORKFLOW, validateWorkflow } from "./workflowSettings";
describe("validateWorkflow", () => {
it("falls back to defaults for missing or malformed values", () => {
expect(validateWorkflow(undefined)).toEqual(DEFAULT_WORKFLOW);
const v = validateWorkflow({
vcs: {
historyLimit: -5,
git: { updateMethod: "squash", incomingCheck: "never", largeFileMb: 0 },
confirmation: { onPatchCreated: "always" },
issueNavigation: [{ pattern: "" }, { pattern: "#(\\d+)", link: "x/$1" }],
},
console: { bufferKb: 1e12, foldPatterns: ["a", 3, ""] },
terminal: { cursorShape: "bar", env: { A: "1", B: 2 }, tabName: " " },
externalTools: [{ name: "Lint", id: "x" }, { name: "" }, { name: "Again", id: "x" }],
});
expect(v.vcs.historyLimit).toBe(10);
expect(v.vcs.git.updateMethod).toBe("merge");
expect(v.vcs.git.incomingCheck).toBe("never");
expect(v.vcs.git.largeFileMb).toBe(1);
expect(v.vcs.issueNavigation).toEqual([{ pattern: "#(\\d+)", link: "x/$1" }]);
expect(v.vcs.commit.nonModal).toBe(true);
expect(v.vcs.confirmation.onPatchCreated).toBe("ask");
expect(v.vcs.shelf.removeApplied).toBe(false);
expect(v.console.bufferKb).toBe(1_048_576);
expect(v.console.foldPatterns).toEqual(["a"]);
expect(v.terminal).toMatchObject({ cursorShape: "bar", env: { A: "1" }, tabName: "Local" });
expect(v.externalTools.map((t) => [t.id, t.name])).toEqual([
["x", "Lint"],
["x_", "Again"],
]);
});
});
describe("splitCommandLine", () => {
it("honours quotes and escapes", () => {
expect(splitCommandLine(`/bin/zsh --login`)).toEqual(["/bin/zsh", "--login"]);
expect(splitCommandLine(`sh -c "echo 'a b'" x\\ y ''`)).toEqual(["sh", "-c", "echo 'a b'", "x y", ""]);
expect(splitCommandLine(" ")).toEqual([]);
});
});