Skip to content

Commit 7e5b28f

Browse files
committed
fix: resolve Roo history import type checks
1 parent 7ef9dfa commit 7e5b28f

2 files changed

Lines changed: 30 additions & 29 deletions

File tree

src/core/task-persistence/__tests__/importRooTaskHistory.spec.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ describe("importRooTaskHistory", () => {
2929
const zooCustomStoragePath = path.join(tempRoot, "zoo-custom")
3030
const getConfigurationMock = vi.mocked(vscode.workspace.getConfiguration)
3131

32-
getConfigurationMock.mockImplementation(
33-
(section: string) =>
34-
({
35-
get: vi
36-
.fn()
37-
.mockReturnValue(
38-
section === "roo-cline"
39-
? rooCustomStoragePath
40-
: section === "zoo-code"
41-
? zooCustomStoragePath
42-
: "",
43-
),
44-
}) as any,
45-
)
32+
getConfigurationMock.mockImplementation((section?: string) => {
33+
const resolvedSection = section ?? ""
34+
return {
35+
get: vi
36+
.fn()
37+
.mockReturnValue(
38+
resolvedSection === "roo-cline"
39+
? rooCustomStoragePath
40+
: resolvedSection === "zoo-code"
41+
? zooCustomStoragePath
42+
: "",
43+
),
44+
} as any
45+
})
4646

4747
const result = await resolveRooHistoryImportPaths(zooGlobalStoragePath)
4848

@@ -62,20 +62,20 @@ describe("importRooTaskHistory", () => {
6262
const zooCustomStorageRoot = path.join(tempRoot, "zoo-custom")
6363
const getConfigurationMock = vi.mocked(vscode.workspace.getConfiguration)
6464

65-
getConfigurationMock.mockImplementation(
66-
(section: string) =>
67-
({
68-
get: vi
69-
.fn()
70-
.mockReturnValue(
71-
section === "roo-cline"
72-
? rooCustomStorageRoot
73-
: section === "zoo-code"
74-
? zooCustomStorageRoot
75-
: "",
76-
),
77-
}) as any,
78-
)
65+
getConfigurationMock.mockImplementation((section?: string) => {
66+
const resolvedSection = section ?? ""
67+
return {
68+
get: vi
69+
.fn()
70+
.mockReturnValue(
71+
resolvedSection === "roo-cline"
72+
? rooCustomStorageRoot
73+
: resolvedSection === "zoo-code"
74+
? zooCustomStorageRoot
75+
: "",
76+
),
77+
} as any
78+
})
7979

8080
await fs.mkdir(path.join(rooDefaultStorageRoot, "tasks", "task-default"), { recursive: true })
8181
await fs.writeFile(

src/core/task-persistence/importRooTaskHistory.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Dirent } from "fs"
12
import * as fs from "fs/promises"
23
import * as path from "path"
34
import * as vscode from "vscode"
@@ -94,7 +95,7 @@ export const importRooTaskHistory = async (globalStoragePath: string): Promise<R
9495

9596
for (const sourceRoot of sourceRoots) {
9697
const sourceTasksRoot = path.join(sourceRoot, "tasks")
97-
let entries: fs.Dirent[]
98+
let entries: Dirent[]
9899

99100
try {
100101
entries = await fs.readdir(sourceTasksRoot, { withFileTypes: true })

0 commit comments

Comments
 (0)