From b64bfd55e8872104b1b1bf2a14512c2c6ea15996 Mon Sep 17 00:00:00 2001 From: mkorwel Date: Thu, 19 Feb 2026 16:51:56 -0600 Subject: [PATCH] fix(cli): resolve build errors and lint issues in experimentCommand.test.ts --- .../src/ui/commands/experimentCommand.test.ts | 31 +++++++------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/packages/cli/src/ui/commands/experimentCommand.test.ts b/packages/cli/src/ui/commands/experimentCommand.test.ts index 5e34073c37..e459451c0f 100644 --- a/packages/cli/src/ui/commands/experimentCommand.test.ts +++ b/packages/cli/src/ui/commands/experimentCommand.test.ts @@ -4,29 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { describe, it, expect, vi, beforeEach, type Mock } from 'vitest'; import { experimentCommand } from './experimentCommand.js'; -import { CommandKind } from './types.js'; +import { CommandKind, type CommandContext } from './types.js'; import { MessageType } from '../types.js'; import { SettingScope } from '../../config/settings.js'; describe('experimentCommand', () => { - let mockContext: { - services: { - config: { - getExperimentValue: vi.Mock; - }; - settings: { - merged: { - experimental: Record; - }; - setValue: vi.Mock; - }; - }; - ui: { - addItem: vi.Mock; - }; - }; + let mockContext: CommandContext; beforeEach(() => { mockContext = { @@ -44,7 +29,11 @@ describe('experimentCommand', () => { ui: { addItem: vi.fn(), }, - }; + session: { + stats: {}, + sessionShellAllowlist: new Set(), + }, + } as unknown as CommandContext; }); it('should have the correct name and description', () => { @@ -59,7 +48,9 @@ describe('experimentCommand', () => { ); it('should list experiments', async () => { - mockContext.services.config.getExperimentValue.mockReturnValue(true); + (mockContext.services.config!.getExperimentValue as Mock).mockReturnValue( + true, + ); await listCommand?.action!(mockContext, ''); expect(mockContext.ui.addItem).toHaveBeenCalledWith(