55 lines · 1.6 KB · TypeScript
RawDownload
import { describe, expect, it } from "vite-plus/test"; import { resolveProjectThreadCreationBranch } from "./projectThreadCreationValidation"; describe("resolveProjectThreadCreationBranch", () => {  it("uses the live checkout for an untouched local draft label and recorded branch", () => {    expect(      resolveProjectThreadCreationBranch({        workspaceMode: "local",        selectedBranch: null,        currentCheckoutBranch: "feature/x",      }),    ).toBe("feature/x");  });   it("prefers an explicit picker choice over the current checkout", () => {    expect(      resolveProjectThreadCreationBranch({        workspaceMode: "local",        selectedBranch: "main",        currentCheckoutBranch: "feature/x",      }),    ).toBe("main");  });   it("stays null when no ref is checked out (detached HEAD, non-repository, status not loaded)", () => {    expect(      resolveProjectThreadCreationBranch({        workspaceMode: "local",        selectedBranch: null,        currentCheckoutBranch: null,      }),    ).toBeNull();  });   it("never borrows the current checkout for a worktree draft", () => {    expect(      resolveProjectThreadCreationBranch({        workspaceMode: "worktree",        selectedBranch: null,        currentCheckoutBranch: "feature/x",      }),    ).toBeNull();  });   it("keeps the explicit base branch for a worktree draft", () => {    expect(      resolveProjectThreadCreationBranch({        workspaceMode: "worktree",        selectedBranch: "main",        currentCheckoutBranch: "feature/x",      }),    ).toBe("main");  });});

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t