mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 18:44:30 -07:00
feat(agents): add support for remote agents (#16013)
This commit is contained in:
@@ -8,6 +8,7 @@ import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import {
|
||||
A2AClientManager,
|
||||
type SendMessageResult,
|
||||
createAdapterFetch,
|
||||
} from './a2a-client-manager.js';
|
||||
import type { AgentCard, Task } from '@a2a-js/sdk';
|
||||
import type { AuthenticationHandler, Client } from '@a2a-js/sdk/client';
|
||||
@@ -302,4 +303,42 @@ describe('A2AClientManager', () => {
|
||||
).rejects.toThrow("Agent 'NonExistentAgent' not found.");
|
||||
});
|
||||
});
|
||||
|
||||
describe('createAdapterFetch', () => {
|
||||
it('normalizes TASK_STATE_ enums to lower-case', async () => {
|
||||
const baseFetch = vi
|
||||
.fn()
|
||||
.mockResolvedValue(
|
||||
new Response(
|
||||
JSON.stringify({ status: { state: 'TASK_STATE_WORKING' } }),
|
||||
),
|
||||
);
|
||||
|
||||
const adapter = createAdapterFetch(baseFetch as typeof fetch);
|
||||
const response = await adapter('http://example.com', {
|
||||
method: 'POST',
|
||||
body: '{}',
|
||||
});
|
||||
const data = await response.json();
|
||||
|
||||
expect(data.status.state).toBe('working');
|
||||
});
|
||||
|
||||
it('lowercases non-prefixed task states', async () => {
|
||||
const baseFetch = vi
|
||||
.fn()
|
||||
.mockResolvedValue(
|
||||
new Response(JSON.stringify({ status: { state: 'WORKING' } })),
|
||||
);
|
||||
|
||||
const adapter = createAdapterFetch(baseFetch as typeof fetch);
|
||||
const response = await adapter('http://example.com', {
|
||||
method: 'POST',
|
||||
body: '{}',
|
||||
});
|
||||
const data = await response.json();
|
||||
|
||||
expect(data.status.state).toBe('working');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user