mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-20 08:42:39 -07:00
fix(cli): resolve build errors and lint issues in experimentCommand.test.ts
This commit is contained in:
@@ -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<string, unknown>;
|
||||
};
|
||||
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(
|
||||
|
||||
Reference in New Issue
Block a user