fix(cli): enable typechecking for ui/commands tests (#11413)

This commit is contained in:
Sandy Tao
2025-10-17 14:20:49 -07:00
committed by GitHub
parent 08e87a59d5
commit 21163a1636
7 changed files with 29 additions and 42 deletions

View File

@@ -9,7 +9,7 @@ import * as fs from 'node:fs';
import * as path from 'node:path';
import { initCommand } from './initCommand.js';
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
import { type CommandContext } from './types.js';
import type { SubmitPromptActionReturn, CommandContext } from './types.js';
// Mock the 'fs' module
vi.mock('fs', () => ({
@@ -61,7 +61,10 @@ describe('initCommand', () => {
vi.mocked(fs.existsSync).mockReturnValue(false);
// Act: Run the command's action
const result = await initCommand.action!(mockContext, '');
const result = (await initCommand.action!(
mockContext,
'',
)) as SubmitPromptActionReturn;
// Assert: Check that writeFileSync was called correctly
expect(fs.writeFileSync).toHaveBeenCalledWith(geminiMdPath, '', 'utf8');