fix(cli): Fix type errors in UI hooks tests (#11483)

This commit is contained in:
Sandy Tao
2025-10-19 17:16:16 -07:00
committed by GitHub
parent 23e52f0ff3
commit 0fd9ff0f53
11 changed files with 356 additions and 277 deletions
@@ -6,7 +6,15 @@
/** @vitest-environment jsdom */
import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest';
import {
describe,
it,
expect,
beforeEach,
vi,
afterEach,
type Mock,
} from 'vitest';
import { renderHook, act, waitFor } from '@testing-library/react';
import { useCommandCompletion } from './useCommandCompletion.js';
import type { CommandContext } from '../commands/types.js';
@@ -45,7 +53,7 @@ const setupMocks = ({
slashCompletionRange?: { completionStart: number; completionEnd: number };
}) => {
// Mock for @-completions
(useAtCompletion as vi.Mock).mockImplementation(
(useAtCompletion as Mock).mockImplementation(
({
enabled,
setSuggestions,
@@ -61,7 +69,7 @@ const setupMocks = ({
);
// Mock for /-completions
(useSlashCompletion as vi.Mock).mockImplementation(
(useSlashCompletion as Mock).mockImplementation(
({
enabled,
setSuggestions,