Skip to content

Commit abb8a21

Browse files
committed
test(webview): replace the any cast on the globalState mock with a typed vi.fn
CodeRabbit review (2026-09-04): the writeDelayMs default test cast mockContext.globalState.get to any to call mockImplementation. Use the same typed reassignment pattern the customModePrompts test in this file already uses — Memento.get has no mock type, so assign a vi.fn with an explicitly typed implementation directly. Behavior is unchanged and the no-explicit-any suppression count for this file drops by one (198 -> 197).
1 parent 065bef1 commit abb8a21

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎src/core/webview/__tests__/ClineProvider.spec.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,8 +1448,9 @@ describe("ClineProvider", () => {
14481448
})
14491449

14501450
test("writeDelayMs defaults to DEFAULT_WRITE_DELAY_MS", async () => {
1451-
// Mock globalState.get to return undefined for writeDelayMs
1452-
;(mockContext.globalState.get as any).mockImplementation((key: string) => {
1451+
// Mock globalState.get to return undefined for writeDelayMs (typed reassignment,
1452+
// same pattern as the customModePrompts test below — Memento.get has no mock type)
1453+
mockContext.globalState.get = vi.fn((key: string) => {
14531454
return key === "writeDelayMs" ? undefined : null
14541455
})
14551456

‎src/eslint-suppressions.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@
10361036
},
10371037
"core/webview/__tests__/ClineProvider.spec.ts": {
10381038
"@typescript-eslint/no-explicit-any": {
1039-
"count": 198
1039+
"count": 197
10401040
}
10411041
},
10421042
"core/webview/__tests__/ClineProvider.sticky-mode.spec.ts": {

0 commit comments

Comments
 (0)