Download projects/gemini-cli/packages/a2a-server/src/task.test.ts from LevelUp2x/adaptai: direct link, hf CLI and curl.
- Browser
- Download file 1.66 kB
-
https://huggingface.co/datasets/LevelUp2x/adaptai/resolve/2147bc06c2ccf123b96f98eace2e6bf6486e7f0e/projects/gemini-cli/packages/a2a-server/src/task.test.ts
- Command line
-
hf download hf://datasets/LevelUp2x/adaptai@2147bc06c2ccf123b96f98eace2e6bf6486e7f0e/projects/gemini-cli/packages/a2a-server/src/task.test.ts
-
curl -L -o task.test.ts https://huggingface.co/datasets/LevelUp2x/adaptai/resolve/2147bc06c2ccf123b96f98eace2e6bf6486e7f0e/projects/gemini-cli/packages/a2a-server/src/task.test.ts
1.66 kB
| /** | |
| * @license | |
| * Copyright 2025 Google LLC | |
| * SPDX-License-Identifier: Apache-2.0 | |
| */ | |
| import { describe, it, expect, vi } from 'vitest'; | |
| import { Task } from './task.js'; | |
| import type { Config, ToolCallRequestInfo } from '@google/gemini-cli-core'; | |
| import { createMockConfig } from './testing_utils.js'; | |
| import type { ExecutionEventBus } from '@a2a-js/sdk/server'; | |
| describe('Task', () => { | |
| it('scheduleToolCalls should not modify the input requests array', async () => { | |
| const mockConfig = createMockConfig(); | |
| const mockEventBus: ExecutionEventBus = { | |
| publish: vi.fn(), | |
| on: vi.fn(), | |
| off: vi.fn(), | |
| once: vi.fn(), | |
| removeAllListeners: vi.fn(), | |
| finished: vi.fn(), | |
| }; | |
| // The Task constructor is private. We'll bypass it for this unit test. | |
| // @ts-expect-error - Calling private constructor for test purposes. | |
| const task = new Task( | |
| 'task-id', | |
| 'context-id', | |
| mockConfig as Config, | |
| mockEventBus, | |
| ); | |
| task['setTaskStateAndPublishUpdate'] = vi.fn(); | |
| task['getProposedContent'] = vi.fn().mockResolvedValue('new content'); | |
| const requests: ToolCallRequestInfo[] = [ | |
| { | |
| callId: '1', | |
| name: 'replace', | |
| args: { | |
| file_path: 'test.txt', | |
| old_string: 'old', | |
| new_string: 'new', | |
| }, | |
| isClientInitiated: false, | |
| prompt_id: 'prompt-id-1', | |
| }, | |
| ]; | |
| const originalRequests = JSON.parse(JSON.stringify(requests)); | |
| const abortController = new AbortController(); | |
| await task.scheduleToolCalls(requests, abortController.signal); | |
| expect(requests).toEqual(originalRequests); | |
| }); | |
| }); | |