mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-14 13:27:38 -07:00
test: optimize DenseToolMessage tests with fake timers
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { renderWithProviders } from '../../../test-utils/render.js';
|
||||
import { renderWithProviders as originalRenderWithProviders } from '../../../test-utils/render.js';
|
||||
import { createMockSettings } from '../../../test-utils/settings.js';
|
||||
import { waitFor } from '../../../test-utils/async.js';
|
||||
import { DenseToolMessage } from './DenseToolMessage.js';
|
||||
@@ -23,6 +23,11 @@ import type {
|
||||
ToolResultDisplay,
|
||||
} from '../../types.js';
|
||||
|
||||
const renderWithProviders = async (
|
||||
component: React.ReactElement,
|
||||
options?: Parameters<typeof originalRenderWithProviders>[1],
|
||||
) => originalRenderWithProviders(component, { height: 40, ...options });
|
||||
|
||||
describe('DenseToolMessage', () => {
|
||||
const defaultProps = {
|
||||
callId: 'call-1',
|
||||
@@ -34,6 +39,14 @@ describe('DenseToolMessage', () => {
|
||||
terminalWidth: 80,
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('explicitly renders the filename in the header for FileDiff results', async () => {
|
||||
const fileDiff: FileDiff = {
|
||||
fileName: 'test-file.ts',
|
||||
|
||||
Reference in New Issue
Block a user