Skip to content

Commit 88630a5

Browse files
test(applyPatch): stub providerRef in handlePartial spec for boundary resolution (#169)
1 parent 0245b78 commit 88630a5

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/core/tools/__tests__/applyPatchTool.partial.spec.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe("ApplyPatchTool.handlePartial", () => {
4040
const mockedIsPathOutsideWorkspace = isPathOutsideWorkspace as MockedFunction<typeof isPathOutsideWorkspace>
4141

4242
let askSpy: MockedFunction<Task["ask"]>
43-
let mockTask: Pick<Task, "cwd" | "ask">
43+
let mockTask: Pick<Task, "cwd" | "ask" | "providerRef">
4444
let tool: ApplyPatchTool
4545

4646
beforeEach(() => {
@@ -52,6 +52,13 @@ describe("ApplyPatchTool.handlePartial", () => {
5252
mockTask = {
5353
cwd,
5454
ask: askSpy,
55+
// handlePartial resolves the workspace boundary via resolveIsOutsideWorkspace,
56+
// which reads providerRef.deref()?.getState(); stub it so it doesn't throw.
57+
providerRef: {
58+
deref: vi.fn().mockReturnValue({
59+
getState: vi.fn().mockResolvedValue({ allowSymlinksOutsideWorkspace: false }),
60+
}),
61+
} as any,
5562
}
5663

5764
mockedIsPathOutsideWorkspace.mockImplementation((absolutePath) =>

0 commit comments

Comments
 (0)