mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-24 13:01:29 -07:00
Migrate core render util to use xterm.js as part of the rendering loop. (#19044)
This commit is contained in:
@@ -231,28 +231,24 @@ describe('DebugProfiler Component', () => {
|
||||
showDebugProfiler: false,
|
||||
constrainHeight: false,
|
||||
} as unknown as UIState);
|
||||
|
||||
// Mock process.stdin and stdout
|
||||
// We need to be careful not to break the test runner's own output
|
||||
// So we might want to skip mocking them if they are not strictly needed for the simple render test
|
||||
// or mock them safely.
|
||||
// For now, let's assume the component uses them in useEffect.
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('should return null when showDebugProfiler is false', () => {
|
||||
it('should return null when showDebugProfiler is false', async () => {
|
||||
vi.mocked(useUIState).mockReturnValue({
|
||||
showDebugProfiler: false,
|
||||
constrainHeight: false,
|
||||
} as unknown as UIState);
|
||||
const { lastFrame } = render(<DebugProfiler />);
|
||||
expect(lastFrame()).toBe('');
|
||||
const { lastFrame, waitUntilReady, unmount } = render(<DebugProfiler />);
|
||||
await waitUntilReady();
|
||||
expect(lastFrame({ allowEmpty: true })).toBe('');
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('should render stats when showDebugProfiler is true', () => {
|
||||
it('should render stats when showDebugProfiler is true', async () => {
|
||||
vi.mocked(useUIState).mockReturnValue({
|
||||
showDebugProfiler: true,
|
||||
constrainHeight: false,
|
||||
@@ -261,12 +257,14 @@ describe('DebugProfiler Component', () => {
|
||||
profiler.totalIdleFrames = 5;
|
||||
profiler.totalFlickerFrames = 2;
|
||||
|
||||
const { lastFrame } = render(<DebugProfiler />);
|
||||
const { lastFrame, waitUntilReady, unmount } = render(<DebugProfiler />);
|
||||
await waitUntilReady();
|
||||
const output = lastFrame();
|
||||
|
||||
expect(output).toContain('Renders: 10 (total)');
|
||||
expect(output).toContain('5 (idle)');
|
||||
expect(output).toContain('2 (flicker)');
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('should report an action when a CoreEvent is emitted', async () => {
|
||||
@@ -277,11 +275,13 @@ describe('DebugProfiler Component', () => {
|
||||
|
||||
const reportActionSpy = vi.spyOn(profiler, 'reportAction');
|
||||
|
||||
const { unmount } = render(<DebugProfiler />);
|
||||
const { waitUntilReady, unmount } = render(<DebugProfiler />);
|
||||
await waitUntilReady();
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
coreEvents.emitModelChanged('new-model');
|
||||
});
|
||||
await waitUntilReady();
|
||||
|
||||
expect(reportActionSpy).toHaveBeenCalled();
|
||||
unmount();
|
||||
@@ -295,11 +295,13 @@ describe('DebugProfiler Component', () => {
|
||||
|
||||
const reportActionSpy = vi.spyOn(profiler, 'reportAction');
|
||||
|
||||
const { unmount } = render(<DebugProfiler />);
|
||||
const { waitUntilReady, unmount } = render(<DebugProfiler />);
|
||||
await waitUntilReady();
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
appEvents.emit(AppEvent.SelectionWarning);
|
||||
});
|
||||
await waitUntilReady();
|
||||
|
||||
expect(reportActionSpy).toHaveBeenCalled();
|
||||
unmount();
|
||||
|
||||
Reference in New Issue
Block a user