Rebind seeded project workspaces to the current worktree
This commit is contained in:
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { copySeededSecretsKey } from "../commands/worktree.js";
|
||||
import { copySeededSecretsKey, rebindWorkspaceCwd } from "../commands/worktree.js";
|
||||
import {
|
||||
buildWorktreeConfig,
|
||||
buildWorktreeEnvEntries,
|
||||
@@ -171,4 +171,32 @@ describe("worktree helpers", () => {
|
||||
fs.rmSync(tempRoot, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("rebinds same-repo workspace paths onto the current worktree root", () => {
|
||||
expect(
|
||||
rebindWorkspaceCwd({
|
||||
sourceRepoRoot: "/Users/nmurray/paperclip",
|
||||
targetRepoRoot: "/Users/nmurray/paperclip-pr-432",
|
||||
workspaceCwd: "/Users/nmurray/paperclip",
|
||||
}),
|
||||
).toBe("/Users/nmurray/paperclip-pr-432");
|
||||
|
||||
expect(
|
||||
rebindWorkspaceCwd({
|
||||
sourceRepoRoot: "/Users/nmurray/paperclip",
|
||||
targetRepoRoot: "/Users/nmurray/paperclip-pr-432",
|
||||
workspaceCwd: "/Users/nmurray/paperclip/packages/db",
|
||||
}),
|
||||
).toBe("/Users/nmurray/paperclip-pr-432/packages/db");
|
||||
});
|
||||
|
||||
it("does not rebind paths outside the source repo root", () => {
|
||||
expect(
|
||||
rebindWorkspaceCwd({
|
||||
sourceRepoRoot: "/Users/nmurray/paperclip",
|
||||
targetRepoRoot: "/Users/nmurray/paperclip-pr-432",
|
||||
workspaceCwd: "/Users/nmurray/other-project",
|
||||
}),
|
||||
).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user