test(FN-4623): cover backend layout resolution paths
Fusion-Task-Id: FN-4623 Fusion-Task-Lineage: 58122853-cab7-4102-9649-4ceda4c5959e
This commit is contained in:
committed by
gsxdsm
parent
0f372f67c3
commit
a2245e1959
@@ -4,6 +4,7 @@ import { join, resolve } from "node:path";
|
||||
import {
|
||||
isInsideConfiguredWorktreesDir,
|
||||
resolveTaskWorktreePath,
|
||||
resolveTaskWorktreePathForBackend,
|
||||
resolveWorktreesDir,
|
||||
} from "../worktree-paths.js";
|
||||
|
||||
@@ -47,4 +48,17 @@ describe("worktree-paths", () => {
|
||||
expect(isInsideConfiguredWorktreesDir(rootDir, undefined, join(rootDir, ".worktrees", "fn-1"))).toBe(true);
|
||||
expect(isInsideConfiguredWorktreesDir(rootDir, undefined, join(rootDir, "fn-1"))).toBe(false);
|
||||
});
|
||||
|
||||
it("delegates to worktrunk backend path resolver", async () => {
|
||||
const resolver = async () => "/tmp/custom/fusion-fn-1";
|
||||
await expect(
|
||||
resolveTaskWorktreePathForBackend(rootDir, "fn-1", undefined, { kind: "worktrunk", resolveWorktreePath: resolver }, "fusion/fn-1"),
|
||||
).resolves.toBe("/tmp/custom/fusion-fn-1");
|
||||
});
|
||||
|
||||
it("falls back to native resolver for non-worktrunk backends", async () => {
|
||||
await expect(
|
||||
resolveTaskWorktreePathForBackend(rootDir, "fn-1", { worktreesDir: "../{repo}.worktrees" } as any, { kind: "native" }, "fusion/fn-1"),
|
||||
).resolves.toBe(resolve(rootDir, "../repo-name.worktrees/fn-1"));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user