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(