Download projects/gemini-cli/packages/cli/src/ui/commands/helpCommand.test.ts from LevelUp2x/adaptai: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/datasets/LevelUp2x/adaptai/resolve/2147bc06c2ccf123b96f98eace2e6bf6486e7f0e/projects/gemini-cli/packages/cli/src/ui/commands/helpCommand.test.ts
- Command line
-
hf download hf://datasets/LevelUp2x/adaptai@2147bc06c2ccf123b96f98eace2e6bf6486e7f0e/projects/gemini-cli/packages/cli/src/ui/commands/helpCommand.test.ts
-
curl -L -o helpCommand.test.ts https://huggingface.co/datasets/LevelUp2x/adaptai/resolve/2147bc06c2ccf123b96f98eace2e6bf6486e7f0e/projects/gemini-cli/packages/cli/src/ui/commands/helpCommand.test.ts
1.44 kB
| /** | |
| * @license | |
| * Copyright 2025 Google LLC | |
| * SPDX-License-Identifier: Apache-2.0 | |
| */ | |
| import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; | |
| import { helpCommand } from './helpCommand.js'; | |
| import { type CommandContext } from './types.js'; | |
| import { createMockCommandContext } from '../../test-utils/mockCommandContext.js'; | |
| import { MessageType } from '../types.js'; | |
| import { CommandKind } from './types.js'; | |
| describe('helpCommand', () => { | |
| let mockContext: CommandContext; | |
| const originalEnv = { ...process.env }; | |
| beforeEach(() => { | |
| mockContext = createMockCommandContext({ | |
| ui: { | |
| addItem: vi.fn(), | |
| }, | |
| } as unknown as CommandContext); | |
| }); | |
| afterEach(() => { | |
| process.env = { ...originalEnv }; | |
| vi.clearAllMocks(); | |
| }); | |
| it('should add a help message to the UI history', async () => { | |
| if (!helpCommand.action) { | |
| throw new Error('Help command has no action'); | |
| } | |
| await helpCommand.action(mockContext, ''); | |
| expect(mockContext.ui.addItem).toHaveBeenCalledWith( | |
| expect.objectContaining({ | |
| type: MessageType.HELP, | |
| timestamp: expect.any(Date), | |
| }), | |
| expect.any(Number), | |
| ); | |
| }); | |
| it('should have the correct command properties', () => { | |
| expect(helpCommand.name).toBe('help'); | |
| expect(helpCommand.kind).toBe(CommandKind.BUILT_IN); | |
| expect(helpCommand.description).toBe('for help on gemini-cli'); | |
| }); | |
| }); | |