mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-10 10:00:53 -07:00
test(cli): refactor tests for async render utilities (#23252)
This commit is contained in:
committed by
GitHub
parent
86a3a913b5
commit
6c78eb7a39
@@ -80,8 +80,8 @@ describe('useToolScheduler', () => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it('initializes with empty tool calls', () => {
|
||||
const { result } = renderHook(() =>
|
||||
it('initializes with empty tool calls', async () => {
|
||||
const { result } = await renderHook(() =>
|
||||
useToolScheduler(
|
||||
vi.fn().mockResolvedValue(undefined),
|
||||
mockConfig,
|
||||
@@ -92,8 +92,8 @@ describe('useToolScheduler', () => {
|
||||
expect(toolCalls).toEqual([]);
|
||||
});
|
||||
|
||||
it('updates tool calls when MessageBus emits TOOL_CALLS_UPDATE', () => {
|
||||
const { result } = renderHook(() =>
|
||||
it('updates tool calls when MessageBus emits TOOL_CALLS_UPDATE', async () => {
|
||||
const { result } = await renderHook(() =>
|
||||
useToolScheduler(
|
||||
vi.fn().mockResolvedValue(undefined),
|
||||
mockConfig,
|
||||
@@ -134,8 +134,8 @@ describe('useToolScheduler', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('preserves responseSubmittedToGemini flag across updates', () => {
|
||||
const { result } = renderHook(() =>
|
||||
it('preserves responseSubmittedToGemini flag across updates', async () => {
|
||||
const { result } = await renderHook(() =>
|
||||
useToolScheduler(
|
||||
vi.fn().mockResolvedValue(undefined),
|
||||
mockConfig,
|
||||
@@ -192,9 +192,9 @@ describe('useToolScheduler', () => {
|
||||
expect(result.current[0][0].responseSubmittedToGemini).toBe(true);
|
||||
});
|
||||
|
||||
it('updates lastToolOutputTime when tools are executing', () => {
|
||||
it('updates lastToolOutputTime when tools are executing', async () => {
|
||||
vi.useFakeTimers();
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
useToolScheduler(
|
||||
vi.fn().mockResolvedValue(undefined),
|
||||
mockConfig,
|
||||
@@ -231,8 +231,8 @@ describe('useToolScheduler', () => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('delegates cancelAll to the Core Scheduler', () => {
|
||||
const { result } = renderHook(() =>
|
||||
it('delegates cancelAll to the Core Scheduler', async () => {
|
||||
const { result } = await renderHook(() =>
|
||||
useToolScheduler(
|
||||
vi.fn().mockResolvedValue(undefined),
|
||||
mockConfig,
|
||||
@@ -285,7 +285,7 @@ describe('useToolScheduler', () => {
|
||||
}) as unknown as Scheduler,
|
||||
);
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
useToolScheduler(onComplete, mockConfig, () => undefined),
|
||||
);
|
||||
|
||||
@@ -310,8 +310,8 @@ describe('useToolScheduler', () => {
|
||||
expect(onComplete).toHaveBeenCalledWith([completedToolCall]);
|
||||
});
|
||||
|
||||
it('setToolCallsForDisplay re-groups tools by schedulerId (Multi-Scheduler support)', () => {
|
||||
const { result } = renderHook(() =>
|
||||
it('setToolCallsForDisplay re-groups tools by schedulerId (Multi-Scheduler support)', async () => {
|
||||
const { result } = await renderHook(() =>
|
||||
useToolScheduler(
|
||||
vi.fn().mockResolvedValue(undefined),
|
||||
mockConfig,
|
||||
@@ -386,8 +386,8 @@ describe('useToolScheduler', () => {
|
||||
expect(toolCalls2.every((t) => t.responseSubmittedToGemini)).toBe(true);
|
||||
});
|
||||
|
||||
it('ignores TOOL_CALLS_UPDATE from non-root schedulers when no tools await approval', () => {
|
||||
const { result } = renderHook(() =>
|
||||
it('ignores TOOL_CALLS_UPDATE from non-root schedulers when no tools await approval', async () => {
|
||||
const { result } = await renderHook(() =>
|
||||
useToolScheduler(
|
||||
vi.fn().mockResolvedValue(undefined),
|
||||
mockConfig,
|
||||
@@ -420,8 +420,8 @@ describe('useToolScheduler', () => {
|
||||
expect(result.current[0]).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('allows TOOL_CALLS_UPDATE from non-root schedulers when tools are awaiting approval', () => {
|
||||
const { result } = renderHook(() =>
|
||||
it('allows TOOL_CALLS_UPDATE from non-root schedulers when tools are awaiting approval', async () => {
|
||||
const { result } = await renderHook(() =>
|
||||
useToolScheduler(
|
||||
vi.fn().mockResolvedValue(undefined),
|
||||
mockConfig,
|
||||
@@ -458,8 +458,8 @@ describe('useToolScheduler', () => {
|
||||
expect(toolCalls[0].status).toBe(CoreToolCallStatus.AwaitingApproval);
|
||||
});
|
||||
|
||||
it('preserves subagent tools in the UI after they have been approved', () => {
|
||||
const { result } = renderHook(() =>
|
||||
it('preserves subagent tools in the UI after they have been approved', async () => {
|
||||
const { result } = await renderHook(() =>
|
||||
useToolScheduler(
|
||||
vi.fn().mockResolvedValue(undefined),
|
||||
mockConfig,
|
||||
@@ -538,9 +538,9 @@ describe('useToolScheduler', () => {
|
||||
expect(result.current[0]).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('adapts success/error status to executing when a tail call is present', () => {
|
||||
it('adapts success/error status to executing when a tail call is present', async () => {
|
||||
vi.useFakeTimers();
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
useToolScheduler(
|
||||
vi.fn().mockResolvedValue(undefined),
|
||||
mockConfig,
|
||||
|
||||
Reference in New Issue
Block a user