stricter checks
CI / verify (pull_request) Successful in 12s

This commit is contained in:
2026-10-10 15:16:53 +02:00
parent ced43fbb11
commit 513d51f702
30 changed files with 984 additions and 470 deletions
+8 -7
View File
@@ -45,9 +45,9 @@ async function fixture() {
let childWorkspaceIDOverride: string | undefined;
let childPathOverride: string | undefined;
let repoOverride: string | undefined;
const run = async (args: string[], cwd: string, signal: AbortSignal) => {
const run = async (args: string[], cwd: string, abort: AbortSignal) => {
calls.push(args);
if (args[0] !== "herdr") return command(args, cwd, signal);
if (args[0] !== "herdr") return command(args, cwd, abort);
if (args[1] === "workspace")
return JSON.stringify({
result: {
@@ -57,7 +57,7 @@ async function fixture() {
},
});
if (args[2] === "list") {
const id = args[4]!;
const id = args[4] ?? "";
const path = id === "w2" ? destination : root;
const sourceWorkspaceID = sourceWorkspaceIDOverride ?? (id === "w2" ? "w1" : id);
const sourcePath = sourcePathOverride ?? root;
@@ -93,10 +93,10 @@ async function fixture() {
expect(args[2]).toBe("create");
expect(args.slice(3, 5)).toEqual(["--cwd", root]);
expect(args.at(-1)).toBe("--no-focus");
branch = args[args.indexOf("--branch") + 1]!;
branch = args[args.indexOf("--branch") + 1] ?? "";
const labelIndex = args.indexOf("--label");
label = labelIndex === -1 ? undefined : args[labelIndex + 1];
const base = args[args.indexOf("--base") + 1]!;
const base = args[args.indexOf("--base") + 1] ?? "";
// Real Git worktree behavior, but only in an isolated temporary repository.
await command(["git", "worktree", "add", "-b", branch, destination, base], root, signal);
return JSON.stringify({
@@ -144,14 +144,15 @@ test("create verifies a linked workspace whose inventory source remains the pare
const f = await fixture();
const root = await f.herdr.root(f.root, f.signal);
expect(root?.workspaceID).toBe("w1");
const destination = await f.herdr.create(root!, "other", "multi-work/fixture", f.signal);
if (!root) throw new Error("Missing Herdr root");
const destination = await f.herdr.create(root, "other", "multi-work/fixture", f.signal);
expect(destination.directory).toBe(f.destination);
expect(destination.branch).toStartWith("multi-work/");
expect(await command(["git", "branch", "--show-current"], f.root, f.signal)).toBe("main");
await f.herdr.verify(
destination.directory,
destination.workspaceID,
root!,
root,
destination.branch,
f.signal,
);