test: add unit test for workspaceFilesMode folders-only mode

This commit is contained in:
Hannes Rudolph 2025-12-15 09:09:27 -07:00
parent 308307aceb
commit e29f38ca72

View file

@ -194,6 +194,30 @@ describe("getEnvironmentDetails", () => {
expect(formatResponse.formatFilesList).not.toHaveBeenCalled()
})
it("should use folders-only mode when workspaceFilesMode is 'folders'", async () => {
mockProvider.getState.mockResolvedValue({
...mockState,
workspaceFilesMode: "folders",
})
const result = await getEnvironmentDetails(mockCline as Task, true)
expect(result).toContain("# Current Workspace Directory")
expect(result).toContain("Folder Structure")
expect(listFiles).toHaveBeenCalledWith(mockCwd, true, 50, true)
expect(formatResponse.formatFilesList).toHaveBeenCalledWith(
mockCwd,
["file1.ts", "file2.ts"],
false,
mockCline.rooIgnoreController,
false,
undefined,
true,
)
})
it("should handle desktop directory specially", async () => {
;(arePathsEqual as Mock).mockReturnValue(true)
const result = await getEnvironmentDetails(mockCline as Task, true)